英文:
Graph API gives empty response in Power Automate HTTP element
问题
我正在尝试获取 SharePoint 网站的驱动器 ID。为了做到这一点,我使用以下元素:
URI 的形式如下:
结果是这样的(状态码 200):
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": []
}
当我在 Graph Explorer 中尝试完全相同的 URI 时,我得到了这个结果:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"createdDateTime": "2022-10-16T00:17:42Z",
"description": "",
"id": "b!xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"lastModifiedDateTime": "2023-01-04T05:44:57Z",
"name": "Documents",
"webUrl": "https://xxxx.sharepoint.com/sites/xxxxxxxx/Shared%20Documents",
"driveType": "documentLibrary",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"email": "x.x@xxxx.xxx",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
"displayName": "x x"
}
},
"owner": {
"group": {
"email": "xxxxxxxx@xxxx.onmicrosoft.com",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
"displayName": "xxxxxxxx xxxx xxxx"
}
},
"quota": {
"deleted": 1794912,
"remaining": 27487786218381,
"state": "normal",
"total": 27487790694400,
"used": 2681107
}
}
]
}
这两个应用程序都具有以下权限:
- Files.ReadWrite.All
- Sites.ReadWrite.All
有人能告诉我为什么这两个应用程序的结果不同吗?任何帮助将不胜感激。
英文:
I am trying to get the drive-ids of a SharePoint site. In order to do that I use the following element:
The URI is in the form of:
The result is this (status code 200):
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": []
}
When I try exactly the same URI in Graph Explorer, I get this:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
"value": [
{
"createdDateTime": "2022-10-16T00:17:42Z",
"description": "",
"id": "b!xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"lastModifiedDateTime": "2023-01-04T05:44:57Z",
"name": "Documents",
"webUrl": "https://xxxx.sharepoint.com/sites/xxxxxxxx/Shared%20Documents",
"driveType": "documentLibrary",
"createdBy": {
"user": {
"displayName": "System Account"
}
},
"lastModifiedBy": {
"user": {
"email": "x.x@xxxx.xxx",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
"displayName": "x x"
}
},
"owner": {
"group": {
"email": "xxxxxxxx@xxxx.onmicrosoft.com",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",
"displayName": "xxxxxxxx xxxx xxxx"
}
},
"quota": {
"deleted": 1794912,
"remaining": 27487786218381,
"state": "normal",
"total": 27487790694400,
"used": 2681107
}
}
]
}
Both applications have the following permissions:
- Files.ReadWrite.All
- Sites.ReadWrite.All
Can anyone tell me why I am getting different results in the two applications? Any help would be greatly appreciated.
答案1
得分: 1
感谢 @jleture,我再次查看了我的权限,结果发现我使用的是委派权限,而不是应用程序权限。更改后问题得以解决。
英文:
Thanks to @jleture I had another look at my permissions and it turned out I was using delegated permissions instead of application permissions. Changing that solved the problem.
答案2
得分: 0
The URI must be:
https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/drives
(with comma)
But your screenshot shows something different, with a colon, like:
https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/drives
I try with my environment, and it's working fine:
英文:
The URI must be:
https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/drives
(with coma)
But your screenshot shows something different, with colon, like:
https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/drives
I try with my environment and it's working fine:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论