Share via

Controlling app access on SharePoint site

Glenn Maxwell 13,346 Reputation points
2021-07-11T16:34:53.617+00:00

Hi All

i was referring the below article(Controlling app access on a specific SharePoint site collections)

https://developer.microsoft.com/en-us/microsoft-365/blogs/controlling-app-access-on-specific-sharepoint-site-collections/

i have created an application in Azure App registration and i have provided API Permission as Sites.Selected. I want to perform the below steps please guide me how to get siteid and perform these steps.

POST https://graph.microsoft.com/v1.0/sites/{siteId}/permissions
Content-Type: application/json
{
"roles": ["write"],
"grantedToIdentities": [{
"application": {
"id": "89ea5c94-7736-4e25-95ad-3fa95f62b66e",
"displayName": "TEST"
}
}]
}

Exchange Online
Exchange Online

A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments
{count} votes

Answer accepted by question author
  1. MichaelHan-MSFT 18,136 Reputation points
    2021-07-12T01:52:13.947+00:00

    Hi @Glenn Maxwell ,

    You could also use site path in the Graph Api, the endpoint would be like the below:

     https://graph.microsoft.com/v1.0/sites/{hostname}:/{relative-path}:/permissions  
    

    For example, you site url is https://contoso.sharepoint.com/sites/test, you could make a call to

    POST https://graph.microsoft.com/v1.0/sites/contoso.sharepoint.com:/sites/test:/permissions  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.