Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Mon Oct 31, 2011 5:24 am Post subject: HOWTO: Populate the License Management database with user data fields when generating licenses using the API |
|
|
When using the Generator API to generate licenses, use the following code before calling the Generate method:
[C#]
Code: | // Get the "Data Fields" plugin
PropertiesPlugin plg = gen.GetUserDataPluginFromName("Data Fields") as PropertiesPlugin;
// Set it as the user-data plugin which the generator will use to retrieve the user-data to embed in the generated license
gen.SetUserDataPlugin(plg);
// populate the fields of the "Data Fields" plugin
plg.GetPropertyByName("Name").Value ="xyz";
plg.GetPropertyByName("Email").Value ="xyz";
plg.GetPropertyByName("Company").Value ="xyz";
// Alternately you can also do the following to set all fields at once...
// plg.SetUserData("first name=xxx;last name=yyy");
// Generate the license...
gen.Generate();
|
[VB.Net]
Code: | ' Get the "Data Fields" plugin
Dim plg As PropertiesPlugin = TryCast(gen.GetUserDataPluginFromName("Data Fields"), PropertiesPlugin)
' Set it as the user-data plugin which the generator will use to retrieve the user-data to embed in the generated license
gen.SetUserDataPlugin(plg)
' populate the fields of the "Data Fields" plugin
plg.GetPropertyByName("Name").Value = "xyz"
plg.GetPropertyByName("Email").Value = "xyz"
plg.GetPropertyByName("Company").Value = "xyz"
' Alternately you can also do the following to set all fields at once...
' plg.SetUserData("first name=xxx;last name=yyy");
' Generate the license...
gen.Generate() |
|
|