To retrieve CRM Entity Attributes List, you will be require to retrieve metadata information through RetrieveAllEntitiesRequest.
After retrieving the metadata, you will get complete list of attributes listed for Entity that you have pass. You can use the following code given below:
// Retrieve the MetaData.
RetrieveEntityRequest metaDataRequest = new RetrieveEntityRequest();
RetrieveEntityResponse metaDataResponse = new RetrieveEntityResponse();
metaDataRequest.EntityFilters = EntityFilters.Attributes;
metaDataRequest.LogicalName = LOGICAL NAME;
// your entity logical name goes here like “account”
metaDataResponse = (RetrieveEntityResponse)service.Execute(metaDataRequest);
EntityMetadata currentEntity = metaDataResponse.EntityMetadata;
//AttributeMetadata contains all the metadata for an entity attribute.
foreach (AttributeMetadata attribute in currentEntity.Attributes)
{
var attributeName = attribute.LogicalName;
}
Thanks.
