cancel
Showing results for 
Search instead for 
Did you mean: 

Graph API - SharePoint - Access Denied

jinilseb
Level 3

Hi Team,

In our process, we need to utilize the SharePoint Graph API to access a particular library within a SharePoint site of a site collection. This is due to the client's stringent internal security policies. However, I am currently encountering difficulties in retrieving the necessary attributes for carrying out SharePoint operations.

I am using the below the VBO for the sharepoint operations.

https://digitalexchange.blueprism.com/dx/entry/3439/solution/microsoft-graph-api---sharepoint

Also I used the following VBO to obtain token with delegated access. PFA Azure AD API Permissions.

https://digitalexchange.blueprism.com/dx/entry/9648/solution/microsoft-graph-api---authentication

Basically I need to perform the below actions:

Download File(VBO Action Name) - Access token , Site Id, Drive Id, File ItemId (Parameters)

Create Folder - AccessToken, SiteId, DriveId , Parent FoldrId, FolderName , Conflict Behaviour

Move File - Access Token , SiteId, Source File ItemId , Source DriveId, Destination Folder ItemId, Destination File Name , Destination DriveId

Upload File - AccessToken , SiteId, DriveId, File Path, File Name , File.

I am able to run the "Get Root Site" action and obtain the root site ID. However, when I attempt to run the "Get drive Items" action using the root site ID to obtain the required attributes, I am receiving "Access denied" errors. Please find attached a screenshot of the error from BP.

Could someone please help me with this.

Note - I have been granted access to the specific libraries within a SharePoint site, but not to the entire site.

35577.png
35578.png
6 REPLIES 6

Hi Jinil,

For Get Drive Items you would need permissions as listed here on the page - https://learn.microsoft.com/en-us/graph/api/driveitem-list-children?view=graph-rest-1.0&tabs=http ;

jinilseb
Level 3

Hi Shashank,

Thank you for your response.

While the client has added the recommended API permissions, I am still unable to retrieve the necessary attributes to navigate the SharePoint library.

My primary challenge is to gather the necessary attributes for navigating the SharePoint library.

In order to run the "Get drive Items" , I need the parameters like Folder Id, Drive ID etc however I am not able to get them.

I was able to execute the "Get Root Site" action and retrieve the Site ID successfully. Afterward, I used this Site ID to run the "Get All Drives" action. However, I did not receive any output in the collection, even though the status code was 200, indicating that the operation was successful. Additionally, the 'Get Default Drive Details' action resulted in an 'Access denied' error. Please find the below response content by running "Get All Drives" Action.

35573.png

Also please find the revised API permissions as follows:

35574.png

Just to clarify, I would like to mention(as already mentioned before) that the user in question has limited access to a specific library within a SharePoint site of a site collection through a delegated token. It's unclear whether this limited access is causing the issue of missing attributes. Before I respond to the client's request and ask for additional site permissions, I need to confirm whether the limited Sharepoint site access granted to the user is the reason behind the missing attributes.

Please let me know if you have any advice on how to proceed.

jinilseb
Level 3

Hi All,

It would be greatly appreciated if someone could provide an update on this. Thank you.

Hi Jinil,

I would suggest using the Graph Explorer to find all the attributes you are looking for.

https://developer.microsoft.com/en-us/graph/graph-explorer ;

You can also look at the permissions required here for Get All Drives

35576.png

jinilseb
Level 3

Hi Shashank,

Thank you for your response.

As mentioned above ,We have added in the necessary permissions for "Get All Drives"  and the status code is 200 however it is receiving no output values in the collection.

Could you please help with this.

Hi Jinil,

Have you tried "enumerate the enumerate the document libraries under the root site" in the Graph explorer to get the Drive ID?