Maybe I stuck somewhere at the architectural Concept of Sharepoint and MS Graph API.
Business Requirement is to prevent User from deleting Files in Sharepoint.
This Question is answered in this Discussion: Prevent deletion of SharePoint files
=> There is a capability to define custom Permission Levels on Sharepoint Level After setting up a custom Permission Level and changing a Document Library Permissions to use the new Permission Level, all Subfolder inherits the parent Permissions:
Get the driveItem Permissions shows following:
{ "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('[REMOVED]')/items('[REMOVED]')/permissions", "value": [ { "id": "[REMOVED]", "roles": [ "owner" ], "shareId": "[REMOVED]", "grantedToV2": { "siteGroup": { "displayName": "Besitzer von [REMOVED]", "id": "3", "loginName": "Besitzer von [REMOVED]" } }, "grantedTo": { "user": { "displayName": "Besitzer von [REMOVED]" } }, "inheritedFrom": {} }, { "id": "[REMOVED]", "roles": [ "read" ], "shareId": "[REMOVED]", "grantedToV2": { "siteGroup": { "displayName": "Besucher von [REMOVED]", "id": "4", "loginName": "Besucher von [REMOVED]" } }, "grantedTo": { "user": { "displayName": "Besucher von [REMOVED]" } }, "inheritedFrom": {} }, { "id": "[REMOVED]", "roles": [ "write" ], "shareId": "[REMOVED]", "grantedToV2": { "siteGroup": { "displayName": "Mitglieder von [REMOVED]", "id": "5", "loginName": "Mitglieder von [REMOVED]" } }, "grantedTo": { "user": { "displayName": "Mitglieder von [REMOVED]" } }, "inheritedFrom": {} } ] }
As shown above: The "Mitglieder von [REMOVED]" has the role "write". It does not show my custom permission.
According to MS Graph DriveItem Permission resource type DriveItems support only three Roles and their associated permissions: owner, read, write.
My Questions are:
- I am aware that all DriveItem has their ListItem twin which represents the Sharepoint Item for the DriveItem. Assumptiom: Sharepoint and DriveItem has their own Permission-Management. It is somehow applied from Sharepoint on DriveItem.
- Why does MS Graph not show a the custom Permission Level as "Role"?
- What will happen If I try to delete the DriveItem? Based on the Permission shown in Sharepoint, It should fail, because I have no delete Permission on the ListItem.
- How to get the actuall Permissions for a DriveItem and also their ListItem Permissions
Thanks!