When issuing a license using the Software Potential web portal it is possible to add one or more Custom Tags to the license. Each tag is a (Name,Value) pair where
- Name can be 50 chars max
- Value can be 4,000 chars max
You can also add Custom Tags using the Software Potential Web Service API when issuing or reissuing a license programmatically . To do this, you add an array CustomTags[]
to the LicenseInfo
object before calling CreateLicense (LicenseInfo LicenseInfo)
or Update License(LicenseInfo LicenseInfo)
methods respectively in the Software Potential LicenseManagementWS API.
You should always add your Custom Tags to the existing array of Custom Tags; this is particularly important when reissuing a license or issuing a license from SKU template as it preserves any pre-existing Custom Tags.
The following code snippet adds a single Custom Tag to a license that is created from a SKU in Software Potential:
public static License CreateLicenseFromSkuIdAndAddCustomTag(string SkuId, UserCredentials Credentials, string PartnerName)
{
using (LicenseManagementWSClient client = CreateLicenseManagementClient(Credentials))
{
try
{
LicenseInfo licenseInfo = client.GetSkuById(SkuId).LicenseInfo;
CustomTag tag = new CustomTag
{
TagName = "Partner Name",
TagValue = "ACME Inc"
};
List customTags = licenseInfo.CustomTags.ToList();
customTags.Add(tag);
licenseInfo.CustomTags = customTags.ToArray();
License license = client.CreateLicense(licenseInfo);
Console.WriteLine("License from SKU - Activation Key: {0}, LicenseID: {1} \n", license.ActivationKey, license.LicenseId);
return license;
}
catch (FaultException apiEx)
{
// handle error
throw apiEx;
}
catch (FaultException argNullEx)
{
// handle error
throw argNullEx;
}
catch (FaultException argEx)
{
// handle error
throw argEx;
}
catch (FaultException genEx)
{
// handle error
throw genEx;
}
};
}
Comments
0 comments
Article is closed for comments.