Restrict app access of graph apis to specific folder of share point

Geetika Garg 0 Reputation points
2025-01-08T10:14:34.0933333+00:00

While restricting an app to access a particular folder in a site only, I used
POST https://graph.microsoft.com/v1.0/sites/{siteId}/drives/{driveId}/items/{itemId}/permissions { "roles": [ "read" ], "grantedTo": { "application": { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } } }
. If i check using permissions GET api, I get a permission for the app ID.
However , when I try and access the contents of the folder using this app, I get accessDenied.

Note: I have given Sites.Specific permissions to this app.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,357 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.
3,473 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 116K Reputation points MVP
    2025-01-08T17:21:23.4966667+00:00

    As mentioned in the other thread, you need the Files.SelectedOperations.Selected scope, not Sites.Selected.


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

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.