【问题标题】:Trying to add a "SharepointDocumentLocation" to MS Dynamics365 via the Web API尝试通过 Web API 将“SharepointDocumentLocation”添加到 MS Dynamics365
【发布时间】:2022-07-06 21:56:33
【问题描述】:

我正在尝试在我的 Dynamics365(云中)系统中创建新的 Sharepoint 文档位置,并且我正在尝试将这些位置链接到现有的 Sharepoint 站点(集合)以及我自己的自定义实体.

我尝试过这样做:

POST /api/data/v9.2/sharepointdocumentlocations

Accept:application/json
Authorization: Bearer (valid JWT token)
Content-Type:application/json
OData-Version: 4.0
OData-MaxVersion: 4.0

{
    "name": "WebDocuments",
    "description": "Some useful description",
    "sharepointdocumentlocation_parent_sharepointsite@odata.bind" : "sharepointsites(0f66e9e3-5dfc-ec11-82e5-0022489f9669)",
    "relativeurl": "site",
    "customEntity_SharePointDocumentLocations@odata.bind": "my_customentity(a654d179-ab61-ec11-8f8f-000d3a64d05c)"
}

但无论我尝试什么,我都会不断收到错误 - 主要是:

验证输入参数时出错:Microsoft.OData.ODataException:未声明的属性“sharepointdocumentlocation_parent_sharepointsite”在负载中只有属性注释,但在负载中没有找到属性值。在 OData 中,只有声明的导航属性和声明的命名流可以表示为没有值的属性。

我一直在研究并发现几篇提供帮助的博客文章 - 不幸的是,这些文章都没有帮助我解决我的问题。

我尝试使用各种字段名称:

  • sharepointdocumentlocation_parent_sharepointsite@odata.bind
  • ParentLocationOrSite

还有更多——但没有任何成功。

有什么想法吗?如何在 Dynamics365 中创建新的 Sharepoint 文档位置,并在 POST 请求中设置其 ParentLocationOrSiteRegardingObjectId 属性?

【问题讨论】:

  • 相信您可能已经尝试过了,但是您能确认一下"parentsiteorlocation": "/sharepointsites(0f66e9e3-5dfc-ec11-82e5-0022489f9669)"吗?根据doc,该属性的逻辑名称是parentsiteorlocation,而不是您提到的parentlocationorsite

标签: c# dynamics-crm odata webapi


【解决方案1】:

该字段的正确语法应该是:

parentsiteorlocation_sharepointsite@odata.bind

由于您有另一个指向自定义实体的查找,我建议使用我的工具 Dataverse REST Builder 创建 Web API 请求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-17
    • 1970-01-01
    • 1970-01-01
    • 2021-04-29
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    相关资源
    最近更新 更多