SPUtility.GetTopEntitlement method

SharePoint 2013

Among a collection of licenses for the same app, finds the most prevailing one.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public static SPAppLicense GetTopEntitlement(
	SPAppLicenseCollection entitlements

Return value

Type: Microsoft.SharePoint.SPAppLicense
One of the highest class licenses.

Conceptually, there is an order of domination between different types of licenses. This order is determined according to the following criteria, in descending order or importance: 1. Non-expired trial licenses and non-trial licenses dominate over expired licenses 2. Licenses with valid tokens dominate over licenses with invalid tokens 3. Licenses with more prevailing license types dominate over the others 4. Licenses with later acquisition dates dominate over the others This method is implemented to get the most dominating license from a set of licenses belonging to the same app. In the case of multiple licenses being the most dominating (according to the all of the criteria above), any of these is returned.