在Dynamics CRM中使用OData检索所有OptionSet值 [英] Retrieve all OptionSet values using OData in Dynamics CRM
问题描述
我对Dynamics CRM还是陌生的.我正在构建一个应在Dynamics CRM中更新实体的应用程序.我可以更新简单类型,而不会出现任何问题.现在的情况是,我在联系人实体中声明了一些自定义选项集.
I am quite new to Dynamics CRM. I am building an app which should update entity in Dynamics CRM. I can update simple types without any issues. Now the situation is, I have declared some custom Option Sets in Contact entity.
是否有任何方法可以检索所有可能的OptionSet值(文本和值),以便我的应用程序可以查找适当的值并将其设置在正在生成的有效载荷中?
Is there any way to retrieve all the possible OptionSet values (text and value) so that my app can look for appropriate value and set it in the payload it is generating?
我在WebAPI
和XRMServices/2011/OrganizationData.svc
中都找不到任何端点.任何帮助都将非常棒.
I can not find any endpoint in WebAPI
as well as XRMServices/2011/OrganizationData.svc
. Any help would be really awesome.
推荐答案
You can use either the Web API or Organisation Service to retrieve The metadata and data models in Microsoft Dynamics CRM. Check out the sub articles of that one for specific examples and details.
Web API示例查询EntityMetadata属性.
Web API example Querying EntityMetadata attributes.
以下查询将仅返回PicklistAttributeMetadata 属性,并将包括LogicalName以及扩展 OptionSet和GlobalOptionSet集合值的导航属性.
The following query will return only the PicklistAttributeMetadata attributes and will include the LogicalName as well as expanding the OptionSet and GlobalOptionSet collection-valued navigation properties.
GET [Organization URI]/api/data/v8.1/EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet
这篇关于在Dynamics CRM中使用OData检索所有OptionSet值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!