问题
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"
]
}
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.
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?
Thanks in advance.
回答1:
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
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.
Other properties, like invitation and inheritedFrom are currently available for OneDrive Personal drives, but not available from OneDrive for Business or SharePoint document libraries.
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).
来源:https://stackoverflow.com/questions/39597547/microsofts-graph-permission-resource-type-has-no-invitations