问题描述
一直在尝试使用 Microsoft Graph 的统一 API 和 OneDrive API 收集有关特定 DriveItem 权限的信息.
Been trying to collect information regarding specific DriveItem's permissions using both Microsoft Graph's unified API, and OneDrive API.
文档指出,权限资源类型中有以下属性可用:
Documentation states the following properties are available in the Permission resource type:
{
"grantedTo": {
"application": {
"displayName": "displayName-value",
"id": "id-value"
},
"device": {
"displayName": "displayName-value",
"id": "id-value"
},
"user": {
"displayName": "displayName-value",
"id": "id-value"
}
},
"id": "id-value",
"invitation": {
"email": "email-value",
"redeemedBy": "redeemedBy-value",
"signInRequired": true
},
"inheritedFrom": {
"driveId": "driveId-value",
"id": "id-value",
"path": "path-value"
},
"link": {
"application": {
"displayName": "displayName-value",
"id": "id-value"
},
"type": "type-value",
"webUrl": "webUrl-value"
},
"roles": [
"roles-value"
]
}
我不认为能够从grantedTo"、id"和roles"属性中检索更多的属性MSGraph 和 OneDriveAPI 中的权限,即使我正在检索有关已与内部和外部用户共享的项目的信息.
I don't seam to be able to retrieve more than "grantedTo", "id" and "roles" properties from a permission, both in MSGraph and OneDriveAPI, even-though I'm retrieving information about an Item that has been shared with both Internal and External users.
扩展对象的属性不起作用.选择所需的字段,虽然它们最初没有显示,但不起作用.
Expanding the object's properties doesn't work.Selecting the desired fields, although they're not showing initially doesn't work.
一个奇怪的注释:从 Permission 的记录中选择不存在的属性将产生 API 错误.将这些字段添加到查询选择中,不会产生错误,但也不会显示属性.
One curious note:Selecting inexistente properties from the Permission's records will produce and API error.Adding these fields to the query selection, will not produce an error, but it won't display the properties either.
这是范围配置问题,还是这些属性的获取方式不同?
Is this a scope configuration issue, or are these properties fetch differently?
提前致谢.
推荐答案
我最近更新了文档以尝试更好地描述这一点:https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/permission_get
I've updated the documentation recently to try and describe this better: https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/permission_get
这些属性中的大多数是可选的/预计不会返回.例如,虽然 grantedTo 将返回 user,但您目前不会看到它返回 application 或 device 的权限,因为权限只分配给用户/组.然而,Graph 在几个地方重用了 IdentitySet 对象,这使得这些属性出现.
Most of these properties are optional / not expected to be returned. For example, while grantedTo will return user you won't see it return application or device for permissions currently, since permissions are only assigned to users/groups. However, Graph reuses the IdentitySet object in several places, which makes those properties appear.
其他属性,例如 invitation 和 inheritedFrom 目前可用于 OneDrive Personal 驱动器,但不可用于 OneDrive for Business 或 SharePoint 文档库.
Other properties, like invitation and inheritedFrom are currently available for OneDrive Personal drives, but not available from OneDrive for Business or SharePoint document libraries.
您应该能够看到为 grantedTo 或 link 返回的值,具体取决于共享权限的类型(用户的显式权限或共享链接).
You should be able to see values returned for either grantedTo or link depending on the type of sharing permission (explicit permissions for a user, or a sharing link).
这篇关于Microsoft's Graph 权限资源类型没有邀请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!