I want to get the ILicensing interface so I can keep track of who has what licenses in our system programmatically. I can't seem to find any documentation on how to go about getting a collection of ILicenseLease objects to achieve this goal. I've tried every method I have in my existing shell package code I've used to get interfaces and none seem to work (I either get a cast exception or end up with a null reference).
A code sample showing how to enumerate across all the actively held licenses would be great. Obviously I could go straight to the database and query the ILicenseLease table but I'm trying to be good and use the API as much as possible.
TIA
How to work with SoftPro.Select.Client.Runtime namespace
Moderator: Phil Barton
-
- Posts: 1381
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: How to work with SoftPro.Select.Client.Runtime namespace
The ILicensing service has all that you need to get the total number of license your enterprise owns and who currently has them in use.
Code: Select all
SelectServer ss = GetService<SelectServer>();
ILicensing lic = ss.GetService<ILicensing>();
// Maximum number of seats available for each product.
List<ILicenseKey> keys = lic.Keys.ToList();
// Current licensed seats in use by machine name and user name.
List<ILicenseLease> leasesInUse = lic.Leases.ToList();
Bob Richards, Senior Software Developer, SoftPro
Re: How to work with SoftPro.Select.Client.Runtime namespace
Thanks, Bob. I'll have to see what I was doing wrong!