图形复制文件操作为应用程序注册提供拒绝访问错误



当我向Graph API发出复制项请求时(根据https://learn.microsoft.com/en-us/graph/api/driveitem-copy),我得到一个";访问被拒绝";请求出错。我的应用程序注册已在管理员同意的情况下请求Files.ReadWrite.All和Sites.ReadWrite.All。难道这个作用域不应该授予对所有文件的复制操作的访问权限吗?

以下请求和响应:

POST https://graph.microsoft.com/v1.0/drives/{sourceDriveId}/items/{sourceItemId}/copy HTTP/1.1
Authorization: Bearer eyJ0......
Accept: application/json
Content-Type: application/json; charset=utf-8
Host: graph.microsoft.com
Content-Length: 211
Expect: 100-continue
{"name" : "Copy-01U5HU23DLMANTOZOCBRCKZAXZ22PYNRGR.pptx", "parentReference" :  { "driveId": "{targetDriveId}",  "id": "{targetFolderId}" } } }
HTTP/1.1 403 Forbidden
Cache-Control: private
Content-Type: application/json
request-id: 7c26c462-805f-4c26-90e3-8ee22ba719c6
client-request-id: 7c26c462-805f-4c26-90e3-8ee22ba719c6
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Canada East","Slice":"SliceC","Ring":"2","ScaleUnit":"000","RoleInstance":"AGSFE_IN_10"}}
Strict-Transport-Security: max-age=31536000
Content-Length: 279
{
"error": {
"code": "accessDenied",
"message": "Access denied",
"innerError": {
"date": "2022-07-20T02:45:37",
"request-id": "7c26c462-805f-4c26-90e3-8ee22ba719c6",
"client-request-id": "7c26c462-805f-4c26-90e3-8ee22ba719c6"
}
}
}

我能够在应用程序注册中使用相同的api权限创建文件夹。我正在使用客户端凭据流生成令牌。

请为客户端凭据流添加应用程序权限。您也不应该使用me,因为我们没有对用户进行身份验证。您可以使用users/userid访问客户端凭证流的API调用中的特定用户相关数据。

最新更新