Partilhar via


RetrieveUserLicenseInfoRequest Class

Definition

Contains the data needed to retrieve the license information for the specified system user (user).

public ref class RetrieveUserLicenseInfoRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class RetrieveUserLicenseInfoRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type RetrieveUserLicenseInfoRequest = class
    inherit OrganizationRequest
Public NotInheritable Class RetrieveUserLicenseInfoRequest
Inherits OrganizationRequest
Inheritance
RetrieveUserLicenseInfoRequest
Attributes

Examples

The following example shows how to use this message. For this sample to work correctly, you must have an authenticated connection to the server with a client that implements the IOrganizationService interface instance.

/// <summary>
/// Writes the current user service plan info to the console
/// </summary>
/// <param name="service">Authenticated client implementing the IOrganizationService interface</param>
static void OutputCurrentUserLicensInfo(IOrganizationService service)
{
    // Get the ID of the current user.
    Guid currentUserId = ((WhoAmIResponse)service.Execute(new WhoAmIRequest())).UserId;

    // Retrieve the license info for the user.
    var request = new RetrieveUserLicenseInfoRequest
    {
        SystemUserId = currentUserId
    };

    var response = (RetrieveUserLicenseInfoResponse)service.Execute(request);

    foreach (ServicePlan sp in response.licenseInfo.ServicePlans)
    {
        Console.WriteLine($"Name:{sp.Name}");
        Console.WriteLine($"DisplayName:{sp.DisplayName}");
    }
}

Example Output:

Name:D365_ENTERPRISE_P1
DisplayName:Dynamics 365 Plan 1

Remarks

For the Web API use the RetrieveUserLicenseInfo function.

Usage

Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of RetrieveUserLicenseInfoResponse.

Privileges and Access Rights

To perform this action, the caller must have access rights on the record specified in the SystemUserId property.

Constructors

RetrieveUserLicenseInfoRequest()

Initializes a new instance of the RetrieveUserLicenseInfoRequest class.

Properties

ExtensionData

Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
SystemUserId

Gets or sets the ID of the system user to retrieve license for.

Applies to