You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To access the Discovery Service using SDK assembly APIs, add a reference to the `Microsoft.Xrm.Sdk.dll` assembly in your Visual Studio project, and then add a `using` statement to access the <xref:Microsoft.Xrm.Sdk.Discovery> namespace.
29
-
30
-
The <xref:Microsoft.Xrm.Sdk.WebServiceClient.DiscoveryWebProxyClient> implements the <xref:Microsoft.Xrm.Sdk.Discovery.IDiscoveryService> interface.
31
-
32
-
The <xref:Microsoft.Xrm.Sdk.Discovery.IDiscoveryService> interface provides <xref:Microsoft.Xrm.Sdk.Discovery.IDiscoveryService.Execute(Microsoft.Xrm.Sdk.Discovery.DiscoveryRequest)> method you will use to pass a instance of the abstract <xref:Microsoft.Xrm.Sdk.Discovery.DiscoveryRequest> class.
33
-
34
-
## Regional Discovery services
35
-
36
-
When you instantiate the <xref:Microsoft.Xrm.Sdk.WebServiceClient.DiscoveryWebProxyClient> you will need to provide a URL for a regional data center using one of the following values.
> If you do not know the user's region, you need to loop through the available regions until you get results. A single global Discovery Service is also available. More information: [Discover the URL for your organization](../webapi/discover-url-organization-web-api.md)
42
-
43
-
## Discovery service messages
44
-
45
-
There are three messages that you can use which all inherit from the abstract <xref:Microsoft.Xrm.Sdk.Discovery.DiscoveryRequest> class.
46
-
47
-
The following table lists the messages that are supported with <xref:Microsoft.Xrm.Sdk.Discovery.IDiscoveryService.Execute(Microsoft.Xrm.Sdk.Discovery.DiscoveryRequest)> method.
48
-
49
-
|Message|Description|
50
-
|-------------|-----------------|
51
-
|<xref:Microsoft.Xrm.Sdk.Discovery.RetrieveUserIdByExternalIdRequest>|Retrieves the logged-on user's ID in Microsoft Dataverse|
52
-
|<xref:Microsoft.Xrm.Sdk.Discovery.RetrieveOrganizationRequest>|Retrieves information about a single organization.|
53
-
|<xref:Microsoft.Xrm.Sdk.Discovery.RetrieveOrganizationsRequest>|Retrieves information about all organizations to which the user belongs.|
54
-
55
-
## Example
56
-
57
-
The following code for a console application uses the <xref:Microsoft.Xrm.Sdk.Discovery.RetrieveOrganizationsRequest> message to retrieve all the organizations for a user.
> The `OrganizationDataService` is the deprecated Organization Data Service, not the Web API. This service does not include a URL for the Web API.
28
+
- Regional Discovery Services are no longer avaialble.
29
+
- To access Global Discovery functionality with the SDK going fowarded, see [here](/powerapps-docs/developer/data-platform/org-service/samples/access-discovery-service.md)
Copy file name to clipboardExpand all lines: powerapps-docs/developer/data-platform/org-service/samples/access-discovery-service.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ If you have set and values in the App.config connection strings, it will use t
29
29
30
30
## What this sample does
31
31
32
-
This sample uses the SDK Assembly `DiscoveryServiceProxy` to query the discovery service with a user's credentials to determine which environments they can connect with.
32
+
This sample uses the SDK Assembly `CrmServiceClient` to query the global discovery service with a user's credentials to determine which environments they can connect with.
33
33
34
34
If one or more environments are returned, the sample will prompt the user to choose one, and then use a `WhoAmIRequest` to return the `SystemUser.UserId` for that environment.
35
35
@@ -43,17 +43,17 @@ This sample requires no special setup except that there are valid user credentia
43
43
44
44
If you know the regional data center that your environments are in, the sample will run faster if you set this value at line 40 of the SampleProgram.cs file.
45
45
46
-
In SampleMethods.cs there is a `DataCenter` enumeration for each of the known data centers. Each enumeration member is decorated with a `Description` notation. All of these members except `Unknown` have the URL for the regional discovery service set as the description.
46
+
In SampleMethods.cs there is a `Clouds` enumeration for each of the known global discovery centers. Each enumeration member is decorated with a `Description` notation. All of these members except `Unknown` have the URL for the global discovery service set as the description.
47
47
48
48
49
49
### Demonstrate
50
50
51
-
1. Using the user credentials and the `dataCenter` value, the program uses the `GetAllOrganizations` static method to retrieve all known environments for the user.
52
-
1. The `GetAllOrganizations`method detects whether the `dataCenter` value is set to `DataCenter.Unknown`. If it is set to this member, this method will loop through all the other members in the `DataCenter` enum and retrieve any environments that are found using the `GetOrganizationsForDataCenter` static method.
51
+
1. Using the user credentials and the `cloud` value, the program uses the `GetAllOrganizations` static method to retrieve all known environments for the user.
52
+
1. The `GetAllOrganizations`method detects whether the `cloud` value is set to `Cloud.Unknown`. If it is set to this member, this method will choose the commerical `Cloud` enum and retrieve any environments that are found using the `GetOrganizationsForCloud` static method.
53
53
54
-
If a specific data center is set, `GetAllOrganizations` will simply call `GetOrganizationsForDataCenter` with those values.
54
+
If a specific data center is set, `GetAllOrganizations` will simply call `GetOrganizationsForCloud` with those values.
55
55
56
-
1. The `GetOrganizationsForDataCenter` method extracts the data center discovery service Url from the member `Description` decoration and uses it together with the user credentials to execute the `RetrieveOrganizationsRequest` discovery service message.
56
+
1. The `GetOrganizationsForCloud` method extracts the cloud's discovery service Url from the member `Description` decoration and uses it together with the user credentials to execute the `DiscoverGlobalOrganizations` CrmServiceClient helper message.
57
57
58
58
A `System.ServiceModel.Security.SecurityAccessDeniedException` is expected when the user has no environments in a specific data center.
0 commit comments