RE: Count Attributes per entity
Hi
I dont see why you cant the following query on XrmToolBox Code Now plugin
EntityQueryExpression entityQueryExpression = new EntityQueryExpression
{
Properties = new MetadataPropertiesExpression
{
AllProperties = false,
PropertyNames = { "LogicalName", "DisplayName", "Attributes", "PrimaryIdAttribute", "ObjectTypeCode", "SchemaName" }
},
AttributeQuery = new AttributeQueryExpression
{
Properties = new MetadataPropertiesExpression(AttributeMetadataProperties)
{
AllProperties = false
}
},
};
RetrieveMetadataChangesRequest retrieveMetadataChangesRequest = new RetrieveMetadataChangesRequest
{
Query = entityQueryExpression,
ClientVersionStamp = null
};
var response = (RetrieveMetadataChangesResponse)service.Execute(retrieveMetadataChangesRequest);
Console.WriteLine("Entity attribute coutnts");
if (response.EntityMetadata != null && response.EntityMetadata.Any())
{
foreach (var entityMetadata in response.EntityMetadata)
{
Console.WriteLine(entityMetadata.LogicalName + "has " + entityMetadata.Attributes.Count() + " attributes");
}
}