Issue Encountered with PermissionCollectionResponse for Shared Folder with Read Role
I am presently using the Microsoft Graph Java SDK to handle folders within my OneDrive account from my application.
Specifically, I utilize the Permissions Graph API to retrieve permissions for a folder item shared on my OneDrive with read-only access.
I've been relying on this API for over 2 years to carry out operations successfully. However, I've recently noticed a disruption in its functionality when attempting to retrieve permissions for a read-only folder that has been shared with me.
The documentation says, the permissions collection includes potentially sensitive information and may not be available for every caller.
- For the owner of the item, all sharing permissions will be returned. This includes co-owners.
- For a non-owner caller, only the sharing permissions that apply to the caller are returned.
- Sharing permission properties that contain secrets (e.g. shareId and webUrl) are only returned for callers that are able to create the sharing permission.
Now, despite the above points, I've encountered an inconsistency. When I attempt to fetch permissions for a folder shared with me with read permission, I do not receive the permissions granted to me. This seems to contradict the second point mentioned earlier.
Steps to Reproduce :
- Initialize the Microsoft Graph Java SDK.
- Retrieve permissions for a read only shared folder using the appropriate method.
- Check the
PermissionCollectionResponse
for inconsistencies.
Below is the SDK I'm using:
PermissionCollectionResponse permissionCollectionResponse = graphServiceClient
.drives()
.byDriveId(DRIVE_ID)
.items()
.byDriveItemId(DRIVE_ITEM_ID)
.permissions()
.buildRequest()
.get();
Below is a sample response I receive as a read-only recipient of the folder:
{
"additionalData": {
"value0": false,
"value1": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('drive id removed for privacy reasons')/items('item id removed for privacy reasons')/permissions"
}
},
"value": {
"value0": false,
"value1": [
{
"backingStore": {
"isInitializationCompleted": true,
"returnOnlyChangedValues": false,
"store": {
"grantedTo": {
"value0": false,
"value1": {
"backingStore": {
"isInitializationCompleted": true,
"returnOnlyChangedValues": false,
"store": {
"additionalData": {
"value0": false,
"value1": {}
},
"user": {
"value0": false,
"value1": {
"backingStore": {
"isInitializationCompleted": true,
"returnOnlyChangedValues": false,
"store": {
"displayName": {
"value0": false,
"value1": "Test name"
},
"additionalData": {
"value0": false,
"value1": {
"email": "user email removed for privacy reasons"
}
},
"id": {
"value0": false,
"value1": "user id removed for privacy reasons"
}
},
"subscriptionStore": {}
}
}
}
},
"subscriptionStore": {}
}
}
},
"roles": {
"value0": false,
"value1": [
"owner"
]
},
"shareId": {
"value0": false,
"value1": "permission id removed for privacy reasons"
},
"additionalData": {
"value0": false,
"value1": {
"@deprecated.GrantedTo": "GrantedTo has been deprecated. Refer to GrantedToV2"
}
},
"id": {
"value0": false,
"value1": "permission id removed for privacy reasons"
},
"grantedToV2": {
"value0": false,
"value1": {
"backingStore": {
"isInitializationCompleted": true,
"returnOnlyChangedValues": false,
"store": {
"additionalData": {
"value0": false,
"value1": {}
},
"odataType": {
"value0": false,
"value1": "#microsoft.graph.sharePointIdentitySet"
},
"user": {
"value0": false,
"value1": {
"backingStore": {
"isInitializationCompleted": true,
"returnOnlyChangedValues": false,
"store": {
"displayName": {
"value0": false,
"value1": "Test name"
},
"additionalData": {
"value0": false,
"value1": {
"email": "user email removed for privacy reasons"
}
},
"id": {
"value0": false,
"value1": "user id removed for privacy reasons"
},
"odataType": {
"value0": false,
"value1": "#microsoft.graph.sharePointIdentity"
}
},
"subscriptionStore": {}
}
}
},
"siteUser": {
"value0": false,
"value1": {
"backingStore": {
"isInitializationCompleted": true,
"returnOnlyChangedValues": false,
"store": {
"displayName": {
"value0": false,
"value1": "Test name"
},
"loginName": {
"value0": false,
"value1": "i:0#.f|membership|user email removed for privacy reasons"
},
"additionalData": {
"value0": false,
"value1": {
"email": "user email removed for privacy reasons"
}
},
"id": {
"value0": false,
"value1": "3"
},
"odataType": {
"value0": false,
"value1": "#microsoft.graph.sharePointIdentity"
}
},
"subscriptionStore": {}
}
}
}
},
"subscriptionStore": {}
}
}
}
},
"subscriptionStore": {}
}
}
]
}
}