Why EntityMetadata.DisplayName.UserLocalizedLabel is null for some entities?
public List<ValuesResponseData> Entities(IOrganizationService service) { RetrieveAllEntitiesRequest retrieveEntities = new RetrieveAllEntitiesRequest() { EntityFilters = EntityFilters.Attributes, RetrieveAsIfPublished = true }; RetrieveAllEntitiesResponse retrieveEntitiesResponse = (RetrieveAllEntitiesResponse)service.Execute(retrieveEntities); EntityMetadata[] entityMetadatas = retrieveEntitiesResponse.EntityMetadata; List<ValuesResponseData> entityresponsedata = new List<ValuesResponseData>(); for(int i = 0; i < entityMetadatas.Length; i++) { ValuesResponseData tempEntityResponse = new ValuesResponseData(); if (entityMetadatas[i].DisplayName.UserLocalizedLabel != null) { tempEntityResponse.Nome = entityMetadatas[i].DisplayName.UserLocalizedLabel.Label.ToString().Replace('"', '\''); tempEntityResponse.LogicalName = entityMetadatas[i].LogicalName; tempEntityResponse.PrimaryName = entityMetadatas[i].PrimaryNameAttribute; entityresponsedata.Add(tempEntityResponse); } } return entityresponsedata; }
After I execute this code, I don't get the list of all entities because for some of them
DisplayName.UserLocalizedLabel is null.