【发布时间】:2012-12-06 02:59:23
【问题描述】:
我有一个 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;
}
【问题讨论】:
-
你在使用早期绑定实体吗?
标签: c# dynamics-crm-2011 xrm