Reputation: 121
I am building a connector to CRM Dynamics. I would like to get (discover) all the entities with their fields. There for, I am using the IOrganizationService interface with RetrieveAllEntitiesRequest. I do get all the entities names BUT I don't know how to get all fields (columns) of any entity.
please help...
hagai
Upvotes: 2
Views: 777
Reputation: 11
We need to create RetrieveAllEntitiesRequest
first
RetrieveAllEntitiesRequest entityRequest = new RetrieveAllEntitiesRequest();
Then call the service.execute()
to retrieve results
there is a blog post which explains really well.
Upvotes: 0
Reputation: 17552
It sounds like your almost there. This it taken from the MSDN sample: Dump Attribute Metadata to a File.
RetrieveAllEntitiesRequest request = new RetrieveAllEntitiesRequest()
{
EntityFilters = EntityFilters.Attributes,
RetrieveAsIfPublished = true
};
// Retrieve the MetaData.
RetrieveAllEntitiesResponse response = (RetrieveAllEntitiesResponse)_serviceProxy.Execute(request);
foreach (EntityMetadata currentEntity in response.EntityMetadata)
{
foreach (AttributeMetadata currentAttribute in currentEntity.Attributes)
{
Console.WriteLine("LogicalName: " + currentAttribute.LogicalName);
}
}
Upvotes: 2