简体   繁体   中英

Trying to add a "SharepointDocumentLocation" to MS Dynamics365 via the Web API

I'm trying to create new Sharepoint document locations in my Dynamics365 (in the cloud) system, and I'm trying to link those to an existing Sharepoint Site (collection), as well as to a custom entity of my own.

I tried to do this:

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)"
}

but no matter what I try, I keep getting errors - mostly along the lines of:

An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'sharepointdocumentlocation_parent_sharepointsite' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.

I have been researching and found several blog posts offering help - unfortunately, none of that has helped me solve my issue.

I tried to use various field names:

  • sharepointdocumentlocation_parent_sharepointsite@odata.bind
  • ParentLocationOrSite

and quite a few more - yet without any success.

Any ideas? How can I create a new Sharepoint document location in Dynamics365, and set its ParentLocationOrSite and RegardingObjectId properties in the POST request?

The correct syntax for that field should be:

parentsiteorlocation_sharepointsite@odata.bind

as you have another lookup pointing to a custom entity, I suggest to use my tool Dataverse REST Builder to create the Web API requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM