More About This Website

All information is provided "AS IS" with no warranties, and confers no rights

Login
Powered by Squarespace

CRM 4.0 FAQ > MetaData API > Is a Web Service reference required to access Metadata

Search the FAQ for entries containing:

One of the things that may not be as obvious is that you can actually access the MetaData web services using the MetadataService class that is part of the type proxy assembly.  Keep in mind that unlike the CRMService that is dynamic based on the custom entities that you add to the CRM organization, the Metadata service is static and does not change.

The following shows the minimal code to use the Metadata service via the proxy

CrmAuthenticationToken authToken = new CrmAuthenticationToken()
authToken.OrganizationName = "myorg"
MetadataService ms = new MetadataService();
ms.CrmAuthenticationTokenValue = authToken;
ms.Credentials = new NetworkCredential("myuser", "mypass");
ms.Url = http://myserver/MSCRMServices/2007/MetadataService.asmx
RetrieveEntityRequest req = new RetrieveEntityRequest();
req.EntityItems = Microsoft.Crm.Sdk.Metadata.EntityItems.EntityOnly;
req.LogicalName = "ctccrm_traceconfig"

RetrieveEntityResponse resp = ms.Execute(req) as RetrieveEntityResponse;

Last updated on October 2, 2007 by David Yack