1 year ago

#361390

test-img

Mihai P.

Application User access to SharePoint through D365

We use an application user (https://learn.microsoft.com/en-us/powerapps/developer/data-platform/use-single-tenant-server-server-authentication) to do CRUD operations for dynamics crm, everything works fine except when we start to upload files to the D365 CRM. We are using the clound base version of the CRM.

The call that we make looks like this

curl --location --request POST 'https://{CRM-INSTANCE}.crm6.dynamics.com/api/data/v9.0/UploadDocument' \
--header 'Authorization: Bearer {TOKEN_PLACEHOLDER}' \
--header 'OData-MaxVersion: 4.0' \
--header 'OData-Version: 4.0' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Cookie: ARRAffinity=d33afaef86fb660a97ce9fe142520dd808ad8aaee8c775b216ff896553cb48c5; ReqClientId=d37cd1a9-79a8-4e7c-b0ad-280e64968576; orgId=879cd69e-8d15-49c7-9c44-f7cdeb21848a' \
--data-raw '{
    "Content": "dGVzdGZpbGU=",
    "Entity": {
        "@odata.type": "Microsoft.Dynamics.CRM.sharepointdocument",
        "locationid": "",
        "title": "testme.txt"
    },
    "OverwriteExisting": true,
    "ParentEntityReference": {
        "@odata.type": "Microsoft.Dynamics.CRM.account",
        "accountid": "{ACCOUNTID_PLACEHOLDER}"
    },
    "FolderPath": ""
}'

When we upload a file through this dynamics 365 CRM API, we encounter this error.

The error with status code 500(Internal Server Error):

{
    "error": {
        "code": "0x80060761",
        "message": "Failed to connect to SharePointSite."
    }
}

But we already configured SharePoint for dynamics CRM document management (we can see the documents in D365), and we can upload to D365 CRM on the web console.

We are a little stumped on what to even look at. What we already tried is:

  1. we gave the app user access to SharePoint, we can upload the file directly to sharepoint using the SharePoint CRM, but we want to use the UploadDocument API from D365.
  2. we cannot see any obvious permissions that we can give to our D365 application user to have access to Sharepoint. I searched for this but there is no role that we can tell does this already.

dynamics-crm

sharepoint-online

dynamics-crm-online

0 Answers

Your Answer

Accepted video resources