- Oakleaf's Dynamics CRM 2011 beta site is no longer accessible for discovery operations because the beta program terminated last week.
- Rhett Clinton suggested checking out his CRM 2011 OData Query Designer on CodePlex (see Comment).
Originally published 9/21/2010.
Microsoft Dynamics CRM 2011 is the first version to include a full-scale OData provider.
After importing 91 Account and 91 Contact items imported from a comma-separated-values (CSV) file created by Access 2010 from the Northwind Customers table, I had enough content to begin examining the OData feeds with IE 8 and Fiddler 2:
The URLs in this post are examples only. Authentication is required to access Dynamics xRM content; you must be logged into your Dynamics CRM Online account to download OData content with a browser.
Default Collection List
Here (https://oakleafsystems.crm.dynamics.com/xrmservices/2011/organizationdata.svc/) is the entry point to the OakLeaf Systems instance, which identifies 237 collections, of which the first 10 are shown here:
Note: The DynamicsCrmOnlineOData.zip file on Windows Live SkyDrive contains all this post’s sample text files.
The following URL returns ~3.8 MB of metadata for the EntityTypes listed in the Default https://oakleafsystems.crm.dynamics.com/xrmservices/2011/organizationdata.svc/$metadata feed. Here’s just the first part of the SdkMessageRequestField’s properties:
This URL returns 50 Account records for ALFKI through MAISD https://oakleafsystems.crm.dynamics.com/xrmservices/2011/organizationdata.svc/AccountSet/. Here are the first few property values for Alfreds Futterkiste:
ALFKI Single Account Record
This URL returns the Account record for ALFKI https://oakleafsystems.crm.dynamics.com/xrmservices/2011/organizationdata.svc/AccountSet?$filter=Name%20eq%20'Alfreds%20Futterkiste'. Here are more property values for Alfreds Futterkiste:
Selected Property Values for ALFKI
The following URL returns ALFKI’s CustomerName, ContactName, City, and Country: https://oakleafsystems.crm.dynamics.com/xrmservices/2011/organizationdata.svc/AccountSet?$select=Name,Address1_PrimaryContactName,Address1_City,Address1_Country&$filter=Name%20eq%20'Alfreds%20Futterkiste':
The OakLeafXrmAccountSubsetALFKI.txt file size is 2 kB. Notice that the Address1_PrimaryContactName value is Maria Anders, but the value doesn’t appear in the Accounts list form’s Primary Contact Name column.
Using the $Select instruction to limit the number of property values returned and minimize unnecessary overhead minimizes bandwidth requirements and probably improves performance significantly.
The “Introduction to Programming Models for Microsoft Dynamics CRM” topic of the Microsoft Dynamics CRM 2011 SDK states:
Microsoft Dynamics CRM 2011 uses an entity data model and WCF Data Services technologies to provide a new set of tools that simplify the development of Internet-enabled applications that interact with Microsoft Dynamics CRM. This also enables an additional programming paradigm: an organization service context that tracks changes to objects and supports LINQ queries to retrieve data from Microsoft Dynamics CRM.
The IDiscoveryService Web service is a global installation-level service that allows the caller to determine the correct organization and URL for their needs. Because Microsoft Dynamics CRM 2011 is a multi-tenant environment, a single Microsoft Dynamics CRM server can host multiple business organizations. Because each server may be handling a Web Service method call for a different organization every time, the Web services must be notified of the target organization that a user is intending to reach.
For a Microsoft Dynamics CRM Online installation, the server cluster typically includes several servers; each may be dedicated to multiple organizations. Ideally, and from a performance perspective, each server has a dedicated Web service URL so that it can be accessed directly through the Internet. However, the Microsoft Dynamics CRM server and organization allocation may change as part of datacenter management and load balancing. Therefore, there is an automated way to discover which Microsoft Dynamics CRM server is serving your organization at a given time. For an on-premises installation, a Web service caller may have access to multiple organizations that may be hosted in different Microsoft Dynamics CRM servers inside the data center.
For both the Microsoft Dynamics CRM Online and Microsoft Dynamics CRM 2011 installations, the IDiscoveryService Web service enables you to discover the IOrganizationService Web service endpoint URL and other information about your target organization.
The IDiscoveryService Web service supports a Web service request to return a list of organizations that the specified user belongs to and the URL endpoint addresses of each organization hosted on the Microsoft Dynamics CRM server.
To access the IDiscoveryService Web service, you simply add a reference to Microsoft.Xrm.Sdk.dll assembly to your Microsoft Visual Studio project, then add a using or imports statement to access the Microsoft.Xrm.Sdk.Discovery namespace.
At the request of several readers, following is a description of how I captured the *.txt files in the DynamicsCrmOnlineOData.zip file.
I used Eric Lawrence’s Fiddler v220.127.116.11 beta Web Debugging Proxy to decrypt the HTTPS request and response traffic and save it as a Notepad *.txt file. Decrypting HTTPS traffic requires choosing Tools | Fiddler Options, clicking the HTTPS tab, and marking the Capture HTTPS Connects, Decrypt HTTPS Traffic and, optionally, Ignore Server Certificate Errors check boxes: