Microsoft DataVerse WebAPI 字段/属性名称、逻辑名称还是模式名称?

发布于 2025-01-18 23:41:26 字数 3006 浏览 6 评论 0原文

我目前正在动态创建ODATA查询,以使数据从数据传说中获取。我遇到的问题是您在$选择查询中指定的每个字段/属性的名称似乎会更改betweek logicalName和schemaname。有没有办法确定何时使用逻辑以及何时使用模式? For example, the following query has to use logical for createdby but schema for CreatedByExternalParty

https://xxx.crm11.dynamics.com/api/data/v9.0/accounts(27cacceb-2a0b-ec11-b6e5-0022484220b6)?$select= name &$expand= createdby ( $select= fullname ), CreatedByExternalParty ( $select= fullname )

If I query the EntityDefinition for each of the above two fields, I can't see any difference between them in terms of metadata:

"@odata.type": "#Microsoft.Dynamics.CRM.LookupAttributeMetadata",
"Targets": [
"externalparty"
],
"Format": "None",
"AttributeOf": null,
"AttributeType": "Lookup",
"ColumnNumber": 230,
"DeprecatedVersion": null,
"IntroducedVersion": "8.0.0.0",
"EntityLogicalName": "account",
"IsCustomAttribute": false,
"IsPrimaryId": false,
"IsValidODataAttribute": true,
"IsPrimaryName": false,
"IsValidForCreate": false,
"IsValidForRead": true,
"IsValidForUpdate": false,
"CanBeSecuredForRead": false,
"CanBeSecuredForCreate": false,
"CanBeSecuredForUpdate": false,
"IsSecured": false,
"IsRetrievable": false,
"IsFilterable": false,
"IsSearchable": false,
"IsManaged": true,
"LinkedAttributeId": null,
"LogicalName": "createdbyexternalparty",
"IsValidForForm": true,
"IsRequiredForForm": false,
"IsValidForGrid": true,
"SchemaName": "CreatedByExternalParty",
"ExternalName": null,
"IsLogical": false,
"IsDataSourceSecret": false,
"InheritsFrom": null,
"CreatedOn": "1900-01-01T00:00:00Z",
"ModifiedOn": "1900-01-01T00:00:00Z",
"SourceType": null,
"AutoNumberFormat": "",
"MetadataId": "827e9002-b547-49fc-9e8d-a6b1cfcef33b",
"HasChanged": null,
"AttributeTypeName": {
"Value": "LookupType"
}
"@odata.type": "#Microsoft.Dynamics.CRM.LookupAttributeMetadata",
"Targets": [
"systemuser"
],
"Format": "None",
"AttributeOf": null,
"AttributeType": "Lookup",
"ColumnNumber": 52,
"DeprecatedVersion": null,
"IntroducedVersion": "5.0.0.0",
"EntityLogicalName": "account",
"IsCustomAttribute": false,
"IsPrimaryId": false,
"IsValidODataAttribute": true,
"IsPrimaryName": false,
"IsValidForCreate": false,
"IsValidForRead": true,
"IsValidForUpdate": false,
"CanBeSecuredForRead": false,
"CanBeSecuredForCreate": false,
"CanBeSecuredForUpdate": false,
"IsSecured": false,
"IsRetrievable": false,
"IsFilterable": false,
"IsSearchable": false,
"IsManaged": true,
"LinkedAttributeId": null,
"LogicalName": "createdby",
"IsValidForForm": true,
"IsRequiredForForm": false,
"IsValidForGrid": true,
"SchemaName": "CreatedBy",
"ExternalName": null,
"IsLogical": false,
"IsDataSourceSecret": false,
"InheritsFrom": null,
"CreatedOn": "1900-01-01T00:00:00Z",
"ModifiedOn": "1900-01-01T00:00:00Z",
"SourceType": null,
"AutoNumberFormat": "",
"MetadataId": "b863fe8a-6393-42ec-a540-972d3b45bd7b",
"HasChanged": null,
"AttributeTypeName": {
"Value": "LookupType"
}

Any help would be great, thanks 。

I am currently creating oData queries dynamically to get data out of dataverse. The problem I have is the name for each field/attribute that you specify in the $select query seems to change betweek LogicalName and SchemaName. Is there a way to determine when to use logical and when to use schema? For example, the following query has to use logical for createdby but schema for CreatedByExternalParty

https://xxx.crm11.dynamics.com/api/data/v9.0/accounts(27cacceb-2a0b-ec11-b6e5-0022484220b6)?$select= name &$expand= createdby ( $select= fullname ), CreatedByExternalParty ( $select= fullname )

If I query the EntityDefinition for each of the above two fields, I can't see any difference between them in terms of metadata:

"@odata.type": "#Microsoft.Dynamics.CRM.LookupAttributeMetadata",
"Targets": [
"externalparty"
],
"Format": "None",
"AttributeOf": null,
"AttributeType": "Lookup",
"ColumnNumber": 230,
"DeprecatedVersion": null,
"IntroducedVersion": "8.0.0.0",
"EntityLogicalName": "account",
"IsCustomAttribute": false,
"IsPrimaryId": false,
"IsValidODataAttribute": true,
"IsPrimaryName": false,
"IsValidForCreate": false,
"IsValidForRead": true,
"IsValidForUpdate": false,
"CanBeSecuredForRead": false,
"CanBeSecuredForCreate": false,
"CanBeSecuredForUpdate": false,
"IsSecured": false,
"IsRetrievable": false,
"IsFilterable": false,
"IsSearchable": false,
"IsManaged": true,
"LinkedAttributeId": null,
"LogicalName": "createdbyexternalparty",
"IsValidForForm": true,
"IsRequiredForForm": false,
"IsValidForGrid": true,
"SchemaName": "CreatedByExternalParty",
"ExternalName": null,
"IsLogical": false,
"IsDataSourceSecret": false,
"InheritsFrom": null,
"CreatedOn": "1900-01-01T00:00:00Z",
"ModifiedOn": "1900-01-01T00:00:00Z",
"SourceType": null,
"AutoNumberFormat": "",
"MetadataId": "827e9002-b547-49fc-9e8d-a6b1cfcef33b",
"HasChanged": null,
"AttributeTypeName": {
"Value": "LookupType"
}
"@odata.type": "#Microsoft.Dynamics.CRM.LookupAttributeMetadata",
"Targets": [
"systemuser"
],
"Format": "None",
"AttributeOf": null,
"AttributeType": "Lookup",
"ColumnNumber": 52,
"DeprecatedVersion": null,
"IntroducedVersion": "5.0.0.0",
"EntityLogicalName": "account",
"IsCustomAttribute": false,
"IsPrimaryId": false,
"IsValidODataAttribute": true,
"IsPrimaryName": false,
"IsValidForCreate": false,
"IsValidForRead": true,
"IsValidForUpdate": false,
"CanBeSecuredForRead": false,
"CanBeSecuredForCreate": false,
"CanBeSecuredForUpdate": false,
"IsSecured": false,
"IsRetrievable": false,
"IsFilterable": false,
"IsSearchable": false,
"IsManaged": true,
"LinkedAttributeId": null,
"LogicalName": "createdby",
"IsValidForForm": true,
"IsRequiredForForm": false,
"IsValidForGrid": true,
"SchemaName": "CreatedBy",
"ExternalName": null,
"IsLogical": false,
"IsDataSourceSecret": false,
"InheritsFrom": null,
"CreatedOn": "1900-01-01T00:00:00Z",
"ModifiedOn": "1900-01-01T00:00:00Z",
"SourceType": null,
"AutoNumberFormat": "",
"MetadataId": "b863fe8a-6393-42ec-a540-972d3b45bd7b",
"HasChanged": null,
"AttributeTypeName": {
"Value": "LookupType"
}

Any help would be great, thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流年里的时光 2025-01-25 23:41:26

在 dataverse 论坛上用户的帮助下,我找到了答案,特别是 Guido Preite,他提供了优秀的开源工具 Dataverse 请求Builder

我从他的代码中找到了答案,CreatedByExternalParty的外壳来自于调用RelationshipDefinitions时的导航属性。

/api/data/v9.0/RelationshipDefinitions/Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata?$filter=SchemaName eq 'lk_externalparty_account_createdby'

回复:

"ReferencingEntityNavigationPropertyName": "CreatedByExternalParty",

I found the answer, with help from users on the dataverse forums, especially Guido Preite for providing the excelent open source tool Dataverse Request Builder

I found the answer from his code, the casing of the CreatedByExternalParty comes from the navigation property when calling RelationshipDefinitions.

/api/data/v9.0/RelationshipDefinitions/Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata?$filter=SchemaName eq 'lk_externalparty_account_createdby'

response:

"ReferencingEntityNavigationPropertyName": "CreatedByExternalParty",
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文