Accessing SharePoint Subfolder

I tried different API path variants:

  • /GetFolderByServerRelativeUrl instead of /GetFolderByServerRelativePath
  • Different URL encodings for spaces and special characters
  • Requests to base folders to understand the structure

All of these attempts resulted in either 404 or 403 errors.

Configuration and Permissions

In Microsoft Azure, I have configured the following Graph API permissions:

  • Files.Read.All
  • Files.ReadWrite.All
  • Files.ReadWrite.AppFolder
  • Sites.FullControl.All
  • Sites.Manage.All
  • Sites.Read.All
  • Sites.ReadWrite.All
  • Sites.Selected
  • User.Read
  • User.ReadBasic.All

These permissions show as “Granted for MyCompany” in Azure.

Questions

  1. How can I correctly access the subfolder in a SharePoint subsite via n8n?
  2. Is my API path format correct, or is there a different syntax for subsites?
  3. Could there be an issue with the authentication method, even though I have all the necessary permissions?
  4. Should I use the Microsoft Graph connector instead of the SharePoint HTTP Request? If so, what would be the correct access path?

I appreciate any help or suggestions. Thank you in advance!

  1. Use this endpoint to get your subsite ID:
    GET https://graph.microsoft.com/v1.0/sites?search={subsite-name}
  2. Use this to get the drive ID (document library):
    GET https://graph.microsoft.com/v1.0/sites/{site-id}/drives
  3. Use this to access a subfolder:
    GET https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/root:/Folder1/Folder2:/children
  4. In n8n, use the HTTP Request node with OAuth2 (Microsoft Graph) and these endpoints. Set authentication to use your existing credentials.
  5. Make sure the authenticated app has Sites.Read.All and Files.Read.All granted and admin consented.

No need for /GetFolderByServerRelativePath – use Graph endpoints only.

Ask ChatGPT

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