应用程序用户通过 D365 访问 SharePoint

发布于 2025-01-18 05:07:22 字数 1825 浏览 1 评论 0原文

我们使用应用程序用户(https://learn.microsoft.com/en-us/powerapps/developer/data-platform/use-single-tenant-server-server-authentication)执行 CRUD 操作Dynamics crm,一切正常,除了我们开始将文件上传到 D365 CRM 时。我们正在使用 CRM 的云基础版本。

我们进行的调用如下所示

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": ""
}'

当我们通过 Dynamics 365 CRM API 上传文件时,我们遇到此错误。

状态代码500的错误(内部服务器错误):

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

但是我们已经配置了SharePoint进行动态CRM文档管理(我们可以在D365中看到文档),并且我们可以在Web控制台上上传到D365 CRM。

我们甚至不知道该看什么。我们已经尝试过的是:

  1. 我们授予应用程序用户对 SharePoint 的访问权限,我们可以使用 SharePoint CRM 将文件直接上传到 sharepoint,但我们希望使用 D365 的 UploadDocument API。
  2. 我们看不到任何可以授予 D365 应用程序用户访问 Sharepoint 的明显权限。我搜索了这个,但我们可以告诉没有任何角色已经这样做了。

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.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文