Search in shared Folders - Microsoft

I’m trying to use n8n with the Microsoft Graph API to search inside a publicly shared OneDrive/SharePoint folder. My workflow encodes the public link (including the “?e=…” query string) as a Base64 “shareToken” and issues a GET https://graph.microsoft.com/v1.0/shares/u!/driveItem request to retrieve the shared folder’s driveId and itemId.

In Azure I implemented all possible Scopes including the important ones:
Files.Read.All - Application
Files.Read.All - Delegated
Files.ReadWrite - Delegated
Files.ReadWrite.All - Application
Files.ReadWrite.All - Delegated

My App Registration is for “Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts”

and in my opinion really tried everything but I still get:

Error code

403

Full message

{
  "error": {
    "code": "accessDenied",
    "message": "The sharing link no longer exists, or you do not have permission to access it.",
    "[email protected]": "#Collection(oneDrive.linkFeatures)",
    "@onedrive.linkFeatures": []
  }
}

After that I want to be able to write and edit this shared Folder.

Does anyone have an Idea as to why I can’t access a shared Folder?

When I search in my own folder it works flawlessly…

Thank you very much!

n8n Version: 1.95.2
Source Code: GitHub - n8n-io/n8n: Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

2 Likes

Hey @JulienBlue

Any luck in postman? I have a feeling it maybe the parameters but you mentioned that it works with your own folder.

But, then I recall something that public links can only be used for link guests ie browser, not API with OAuth token. So when you’re trying to use graphapi, it won’t auth because of that.

The file/folder has been shared with your account, not just anyone with the link

I hope this helps,

Samuel

Thanks Samuel,

Havent’t tried with Postman yet.

I’m trying with an “Request administrator consent”-node right now and then getting the access token in seperate and then giving this into the HTTP Request. Found this way in the Microsoft-documentation and haven’t come across it yet, so fingers crossed!

Will keep you updated :slight_smile:

Hey there Again,

No Success…

Regarding your suggestion, that it’s not possible to access shared links via API I think that it should be when I look through this Microsoft documentation:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.