0
我有一个CRM函数,它返回实体中所有属性的属性类型。我的问题是尽管这个方法在过去一直工作,但现在抛出这个错误,无论我传入它的实体如何。尝试反序列化参数时出现CRM错误
尝试反序列化参数http://schemas.microsoft.com/xrm/2011/Contracts/Services:ExecuteResult
这里是我的代码,我传递的“账户”实体时出错。
public string GetFieldType(IOrganizationService svc, string entity, string fieldName)
{
RetrieveEntityRequest request = new RetrieveEntityRequest()
{
EntityFilters = EntityFilters.Attributes,
LogicalName = entity
};
RetrieveEntityResponse response = (RetrieveEntityResponse)svc.Execute(request);
string type = "";
foreach (AttributeMetadata attribute in response.EntityMetadata.Attributes)
{
if (attribute.LogicalName == fieldName)
{ type = attribute.AttributeType.ToString(); }
}
return type;
}
您使用的是早期绑定的实体吗? –