Monday, November 9, 2015

Retrieve all entities and attributes metadata in MS CRM

             
Below code snippet will retrieve all entities metadata which includes it's attributes metadata as well.


              RetrieveAllEntitiesRequest metaDataRequest = new RetrieveAllEntitiesRequest();
                RetrieveAllEntitiesResponse metaDataResponse = new RetrieveAllEntitiesResponse();
                metaDataRequest.EntityFilters = EntityFilters.All;

                // Execute the request.

                metaDataResponse = (RetrieveAllEntitiesResponse)service.Execute(metaDataRequest);

              List<EntityMetadata>   entities = metaDataResponse.EntityMetadata.ToList();




Note: "service" is nothing but an organization service you are going to create and you need to include below namespaces...

using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Metadata;



You may like below posts

Improving MS CRM Performance

Performance Center in MS CRM 2013

date and time field behavior in MS CRM

Upsert in MSCRM

Locking mechanism in MS CRM

Ticker Symbol Field in MS CRM

Themes in MS CRM

Enable Tracing in MS CRM

Calculated Field in Dynamics CRM 2015

IME Mode in MS CRM

No comments:

Post a Comment