> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# NSLicenseAgent

> License query, download, activation.

License query, download, activation.

## Constructors

### NSLicenseAgent()

```crmscript theme={null}
NSLicenseAgent
```

License query, download, activation.

## Methods

## ActivateLicenseInfo(NSExtendedLicenseInfo)

Saves a new license to the database.

```crmscript theme={null}
NSLicenseResult ActivateLicenseInfo(NSExtendedLicenseInfo newLicense)
```

**Returns:** [CRMScript.NetServer.NSLicenseResult](CRMScript.NetServer.NSLicenseResult)

## AddLicenseFromFile(String)

Loads and activates a new license from file/string if the new license is valid.

```crmscript theme={null}
NSExtendedLicenseInfo AddLicenseFromFile(String fileContent)
```

**Returns:** [CRMScript.NetServer.NSExtendedLicenseInfo](CRMScript.NetServer.NSExtendedLicenseInfo)

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
String fileContent;
NSExtendedLicenseInfo res = agent.AddLicenseFromFile(fileContent);
```

## AssignThirdPartyLicenses(Integer,String,String\[])

Assigns third party licenses

```crmscript theme={null}
NSModuleLicenseLink[] AssignThirdPartyLicenses(Integer associateId, String moduleOwner, String[] moduleLicenseNames)
```

**Returns:** [CRMScript.NetServer.NSModuleLicenseLink](CRMScript.NetServer.NSModuleLicenseLink)\[]

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
Integer associateId;
String moduleOwner;
String[] moduleLicenseNames;
NSModuleLicenseLink[] res = agent.AssignThirdPartyLicenses(associateId, moduleOwner, moduleLicenseNames);
```

## ChangeSerialNumber(String,String)

Changes the new serial number for the installation. Requests a new license from SuperLicense, checks if change is authorized.

```crmscript theme={null}
NSLicenseResult ChangeSerialNumber(String newCompanyName, String newSerialNumber)
```

**Returns:** [CRMScript.NetServer.NSLicenseResult](CRMScript.NetServer.NSLicenseResult)

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
String newCompanyName;
String newSerialNumber;
NSLicenseResult res = agent.ChangeSerialNumber(newCompanyName, newSerialNumber);
```

## GetLicenseForAllOwnersFromDB()

Gets all licenses, with usage, from all module owners as they are stored in the database

```crmscript theme={null}
NSExtendedLicenseInfo[] GetLicenseForAllOwnersFromDB()
```

**Returns:** [CRMScript.NetServer.NSExtendedLicenseInfo](CRMScript.NetServer.NSExtendedLicenseInfo)\[]

## GetLicenseFromDB(String)

Gets license, with usage, as it is stored in the database for one particular module owner.

```crmscript theme={null}
NSExtendedLicenseInfo GetLicenseFromDB(String ownerName)
```

**Returns:** [CRMScript.NetServer.NSExtendedLicenseInfo](CRMScript.NetServer.NSExtendedLicenseInfo)

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
String ownerName;
NSExtendedLicenseInfo res = agent.GetLicenseFromDB(ownerName);
```

## GetLicenseFromFile(String)

Loads a new license from file

```crmscript theme={null}
NSExtendedLicenseInfo GetLicenseFromFile(String fileContent)
```

**Returns:** [CRMScript.NetServer.NSExtendedLicenseInfo](CRMScript.NetServer.NSExtendedLicenseInfo)

## GetLicenseFromLicenseServer(String)

```crmscript theme={null}
NSExtendedLicenseInfo GetLicenseFromLicenseServer(String ownerName)
```

**Returns:** [CRMScript.NetServer.NSExtendedLicenseInfo](CRMScript.NetServer.NSExtendedLicenseInfo)

## GetLicenseStatusFromLicenseServer(String)

Gets license information from the license server for a particular module owner.

```crmscript theme={null}
NSCheckLicenseStatusResult GetLicenseStatusFromLicenseServer(String ownerName)
```

**Returns:** [CRMScript.NetServer.NSCheckLicenseStatusResult](CRMScript.NetServer.NSCheckLicenseStatusResult)

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
String ownerName;
NSCheckLicenseStatusResult res = agent.GetLicenseStatusFromLicenseServer(ownerName);
```

## GetModuleLicenseFromDB(String,String)

Gets license information for one particular license module.

```crmscript theme={null}
NSModuleLicense GetModuleLicenseFromDB(String ownerName, String moduleName)
```

**Returns:** [CRMScript.NetServer.NSModuleLicense](CRMScript.NetServer.NSModuleLicense)

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
String ownerName;
String moduleName;
NSModuleLicense res = agent.GetModuleLicenseFromDB(ownerName, moduleName);
```

## GetModuleLicenseHistoryFromLicenseServer(NSExtendedLicenseInfo,NSExtendedModuleLicense)

Gets details about a license from the license server.

```crmscript theme={null}
String GetModuleLicenseHistoryFromLicenseServer(NSExtendedLicenseInfo licenseInfo, NSExtendedModuleLicense moduleLicense)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String)

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
NSExtendedLicenseInfo licenseInfo;
NSExtendedModuleLicense moduleLicense;
String res = agent.GetModuleLicenseHistoryFromLicenseServer(licenseInfo, moduleLicense);
```

## GetSatelliteLicenses(Integer)

Obtains information about satellite module licenses

```crmscript theme={null}
NSLicenseOwner[] GetSatelliteLicenses(Integer satelliteId)
```

**Returns:** [CRMScript.NetServer.NSLicenseOwner](CRMScript.NetServer.NSLicenseOwner)\[]

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
Integer satelliteId;
NSLicenseOwner[] res = agent.GetSatelliteLicenses(satelliteId);
```

## GetShopUrl(String)

Gets the shop URL for the specified module owner.

```crmscript theme={null}
String GetShopUrl(String ownerName)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String)

<Note>
  This can be used to redirect user to the web shop.
</Note>

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
String ownerName;
String res = agent.GetShopUrl(ownerName);
```

## GetThirdPartyLicenseAssignments(Integer,String)

Gets license assignments for an associate for licenses belonging to an other module owner than SuperOffice

```crmscript theme={null}
NSModuleLicenseLink[] GetThirdPartyLicenseAssignments(Integer associateId, String moduleOwner)
```

**Returns:** [CRMScript.NetServer.NSModuleLicenseLink](CRMScript.NetServer.NSModuleLicenseLink)\[]

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
Integer associateId;
String moduleOwner;
NSModuleLicenseLink[] res = agent.GetThirdPartyLicenseAssignments(associateId, moduleOwner);
```

## GetUserLicenses(Integer)

Obtains information about associate module licenses

```crmscript theme={null}
NSLicenseOwner[] GetUserLicenses(Integer associateId)
```

**Returns:** [CRMScript.NetServer.NSLicenseOwner](CRMScript.NetServer.NSLicenseOwner)\[]

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
Integer associateId;
NSLicenseOwner[] res = agent.GetUserLicenses(associateId);
```

## GetUserLicensesMDOList()

Gets all licenses in an NSMDOListItem structure.

```crmscript theme={null}
NSSelectableMDOListItem[] GetUserLicensesMDOList()
```

**Returns:** [CRMScript.NetServer.NSSelectableMDOListItem](CRMScript.NetServer.NSSelectableMDOListItem)\[]

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
NSSelectableMDOListItem[] res = agent.GetUserLicensesMDOList();
```

## RemoveLicenseFromDB(String)

Removes the license from a particular module owner from the database.

```crmscript theme={null}
NSLicenseResult RemoveLicenseFromDB(String moduleOwner)
```

**Returns:** [CRMScript.NetServer.NSLicenseResult](CRMScript.NetServer.NSLicenseResult)

<Note>
  It is not permitted to remove licenses from SuperOffice
</Note>

## UnassignThirdPartyLicenses(Integer,String,String\[])

Unassigns (removes) third-party licenses

```crmscript theme={null}
NSModuleLicenseLink[] UnassignThirdPartyLicenses(Integer associateId, String moduleOwner, String[] moduleLicenseNames)
```

**Returns:** [CRMScript.NetServer.NSModuleLicenseLink](CRMScript.NetServer.NSModuleLicenseLink)\[]

**Example:**

```crmscript theme={null}
NSLicenseAgent agent;
Integer associateId;
String moduleOwner;
String[] moduleLicenseNames;
NSModuleLicenseLink[] res = agent.UnassignThirdPartyLicenses(associateId, moduleOwner, moduleLicenseNames);
```

## ValidateLicenseInfo(NSExtendedLicenseInfo)

Validates that a license is consistent.

```crmscript theme={null}
NSLicenseResult ValidateLicenseInfo(NSExtendedLicenseInfo licenseInfo)
```

**Returns:** [CRMScript.NetServer.NSLicenseResult](CRMScript.NetServer.NSLicenseResult)


## Related topics

- [SuperOffice.WebApi.Agents.LicenseAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.LicenseAgent.md)
- [SuperOffice.WebApi.Agents.ILicenseAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ILicenseAgent.md)
- [License](/en/automation/crmscript/reference/CRMScript.Native.License.md)
- [Get License From License Server](/en/api/reference/restful/agent/license_agent/get-license-from-license-server.md)
- [Get License From D B](/en/api/reference/restful/agent/license_agent/get-license-from-d-b.md)
- [Remove License From D B](/en/api/reference/restful/agent/license_agent/remove-license-from-d-b.md)
