加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 22:02:40 所属栏目:百科 来源:网络整理
导读:我正在努力从C#代码中找到CRM实体属性的依赖关系,但我找不到正确的方法. 像这样的代码: var attributeRequest = new RetrieveAttributeRequest{ EntityLogicalName = "invoice",LogicalName = "billto_city"};var attributeResponse = (RetrieveAttributeRe
我正在努力从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属性,它指示属性的类型(字符串,查找,选项列表,布尔等),但您需要组件类型值,它是解决方案组件的类型(实体,属性,关系,选项集等).在你的情况下它是2.组件类型及其代码的完整表可以在 here找到.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读