Controlling app access on SharePoint site

Glenn Maxwell 11,416 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"
}
}]
}

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,713 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,980 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,532 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,612 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,036 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 Answers by the question author, which helps users to know the answer solved the author's problem.