c# - 查找 Dynamics CRM 实体属性的依赖项

标签 c# dynamics-crm-2011

我正在努力从 C# 代码中寻找 CRM 实体属性的依赖项,但找不到正确的方法。

代码如下:

var attributeRequest = new RetrieveAttributeRequest
{
    EntityLogicalName = "invoice",
    LogicalName = "billto_city"
};

var attributeResponse = (RetrieveAttributeResponse)proxy.Execute(attributeRequest);

var dependenciesRequest = new RetrieveDependenciesForDeleteRequest
{
    ObjectId = (Guid)attributeResponse.AttributeMetadata.MetadataId,
    ComponentType = (int)attributeResponse.AttributeMetadata.AttributeType
};

var dependenciesResponse = (RetrieveDependenciesForDeleteResponse)proxy.Execute(dependenciesRequest);

给出否定结果。我认为将属性 MetadataId 用作 ObjectId 是不正确的。但似乎无法找到属性的 ObjectId

有没有人以前遇到过类似的任务?你是怎么解决的?

最佳答案

您使用 AttributeMetadata.AttributeType 属性,它指示属性的类型(字符串、查找、选择列表、 bool 值等),但您需要 componenttype 值,即解决方案组件的类型(实体、属性、关系、选项集等)。在您的情况下,它是 2。可以找到组件类型及其代码的完整表格 here .

关于c# - 查找 Dynamics CRM 实体属性的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22562230/

相关文章:

reporting-services - 如何在仪表板中使用报告快照

dynamics-crm-2011 - Dynamics CRM 2011 设置报价修订号

dynamics-crm-2011 - 如何在从 CRM 2011 中的 IWorkflowContext 访问的服务上启用代理类型?

c# - WPF。如何使分隔符拉伸(stretch)到菜单宽度?

c# - 使用 LINQ to XML 进行功能构造内的条件

c# - dotnet 不支持多重继承。但是多接口(interface)支持吗?

javascript - 如何使用 odata,Javascript 在 CRM 2011 中获取用户预览时间

c# - 将查询字符串参数传递给第二页

c# - Python 是否适合编写标准、兼容且完整的 SOAP Web 服务?

javascript - 在 CRM 2011 中将两个字段合并为一