How Get, Set, Delete Permission on SharePoint Online Site using Graph API



How to get SharePoint Site ID

[GET] https://graph.microsoft.com/v1.0/sites?search=contoso5


How to set SharePoint Site Permission only to selected App (AAD App reg)

[POST] https://graph.microsoft.com/v1.0/sites/demotenant.sharepoint.com,4465d2n7-e7c4-40df-abfa-364106bbc502,57836gs4-b14f-4061-ba63-fdb0c2a923b6/permissions

Request Body:
============
{
    "roles": [
        "write"
    ],
    "grantedToIdentities": [
        {
            "application": {
                "id": "3795d2n7-fa6d-4203-9076-5c8898799cb8",
                "displayName": "DemoTenantAADApp"
            }
        }
    ]
}


How to get SharePoint Site Permission

[GET] https://graph.microsoft.com/v1.0/sites/demotenant.sharepoint.com,4465d2n7-e7c4-40df-abfa-364106bbc502,57836gs4-b14f-4061-ba63-fdb0c2a923b6/permissions


[Delete] How to Delete Selected SharePoint Site Permission

https://graph.microsoft.com/v1.0/sites/demotenant.sharepoint.com,4465d2n7-e7c4-40df-abfa-364106bbc502,57836gs4-b14f-4061-ba63-fdb0c2a923b6/permissions/wZi00MzkyLWE5Y2UtN4dHw5ZWY4YzU5NS1mYTZkLTQyMDMtOTA3Ni01Yzg4OTg3OTljYjhAMzFhMjEyYTMtYmQwZi00MzkyLWE5Y2UtNTBiMjZhMDlmOGEy


Reference:

Get permission - Microsoft Graph v1.0 | Microsoft Learn


Comments

Popular posts from this blog

In C# CSOM How to Delete Folders Recursively, Sub-Folders, Files in SharePoint Online Document Library

What is SharePoint online default authentication method? And which credential flow it is using to authenticate?