RetrievePolicy Message (DiscoveryService)
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
| Works for all deployment types | Works online only |
Retrieves a policy from the CrmDiscoveryService Web service.
The relevant classes are specified in the following table.
| Type | Class |
| Request | RetrievePolicyRequest |
| Response | RetrievePolicyResponse |
Remarks
The policy is used to obtain a Windows Live (Passport) ticket when authenticating the user for Microsoft Dynamics CRM Online. Refer to the LogonManager class in the SDK sample code at SDK\Helpers\CS\IdCrlWrapper.
Example
The following code samples show how to retrieve a policy for use in Microsoft Dynamics CRM Online authentication.
[C#]
// Provide valid Microsoft Dynamics CRM Live server information.
string hostname = "dev.crm.dynamics.com";
// Create the discovery service.
CrmDiscoveryService discoveryService = new CrmDiscoveryService();
// Set the discovery process properties.
discoveryService.UseDefaultCredentials = true;
discoveryService.Url = String.Format("https://{0}/MSCRMServices/2007/{1}/CrmDiscoveryService.asmx", hostname, "Passport");
// Request the Microsoft Dynamics CRM Online policy.
RetrievePolicyRequest policyRequest = new RetrievePolicyRequest();
RetrievePolicyResponse policyResponse = (RetrievePolicyResponse)discoveryService.Execute(policyRequest);
[Visual Basic .NET]
' Provide valid Microsoft Dynamics CRM Online server information.
Dim hostname As String = "dev.crm.dynamics.com"
' Create the discovery service.
Dim discoveryService As New CrmDiscoveryService()
' Set the discovery process properties.
discoveryService.UseDefaultCredentials = True
discoveryService.Url = String.Format("https://{0}/MSCRMServices/2007/{1}/CrmDiscoveryService.asmx", hostname, "Passport")
' Request the Microsoft Dynamics CRM Online policy.
Dim policyRequest As New RetrievePolicyRequest()
Dim policyResponse As RetrievePolicyResponse = CType(discoveryService.Execute(policyRequest), RetrievePolicyResponse)
See Also
Concepts
Reference
.gif)