Download multiple files from sharepoint

Hi all,
I’m trying to download all files from a specific SharePoint folder (e.g. /Shared Documents/Dana) using n8n.

What I did

  1. Microsoft SharePoint node → Resource: Item → Operation: Get Many

    • This returns items successfully.
    • I also filtered to the folder (so I only want files under /Dana).
  2. Then I loop the results using Loop Over Items / Split In Batches and try:

    • Microsoft SharePoint node → Resource: File → Operation: Download
    • But the node only supports “By ID” (no “By path” option in my version), so I need a file ID.

What I’m seeing in the “Get Many Items” output

Each returned record has fields like:

  • id: 1 (seems like a list item id)
  • webUrl: https://.../Shared%20Documents/Dana/sample.txt
  • contentType.id: 0x0120... (content type)
  • parentReference.id: c5c59b33-8fc3-44a5-915f-9c608c03731c
  • parentReference.siteId: elbitsystems.sharepoint.com,0f496d07-...,303451ee-...
  • parentReference.listId: ecc55e50-...

The problem

When I try to download using the SharePoint File → Download node:

  • Passing webUrl fails (expected ID)
  • Passing id fails (seems to be list item id, not file/driveItem id)
  • Passing contentType.id fails (not a file id)
  • Passing parentReference.id fails (looks like parent folder id)

I always get:

  • 400 Bad request – please check your parameters

What I need help with

  • How do I get the correct file/driveItem ID from the “Get Many Items (Item resource)” output so I can use it in File → Download?
  • Or what is the recommended workflow in n8n to download all files from a folder:
    • Should I use a different SharePoint resource (File instead of Item)?
    • Or should I use an HTTP Request node with Microsoft Graph to download by path?

n8n version: 2.18.7 (self-hosted)
Node: n8n-nodes-base.microsoftSharePoint (latest shown in UI)

Hi @dana_bida

Instead of using the “Item” resource to find your files, use the “File” resource. This ensures the IDs returned are compatible with the Download operation.

  1. Replace your first node:
    • Resource: File
    • Operation: List
  2. Configure the Folder:
    • In the “List” operation, you can specify the folder path or ID. Since you want /Shared Documents/Dana, ensure you are targeting that specific folder.
  3. The Output:
    • The id returned by Resource: FileOperation: List is the DriveItem ID.
  4. The Download Node:
    • Pass this id directly into Resource: FileOperation: Download. This will now resolve the 400 Bad Request error.

If the built-in “File → List” operation doesn’t give you the exact filtering you need, you can use the Microsoft Graph API directly. This is often more reliable for deep folder structures.

Step 1: List files in the folder Use an HTTP Request node:

  • Method: GET
  • URL: https://graph.microsoft.com/v1.0/sites/{{siteId}}/drive/root:/Shared Documents/Dana:/children
    • (Replace {{siteId}} with your site ID or use the site’s hostname/path format).
  • Authentication: Use the same SharePoint/Microsoft credentials.

Step 2: Loop and Download The response will contain a value array. Each object in that array has an id field. This id is the driveItemId.

  • Pass this id to your existing Microsoft SharePointResource: FileOperation: Download node.

Does that help?

@dana_bida the id from Item → Get Many is the list-item id, but Download wants the driveItem id, thats your 400. easiest fix is to skip the download node entirely, the Graph children call already hands you a pre-signed download link per file, so you just GET that, no id juggling:

swap SITE_ID for the parentReference.siteId you already see in your output, reuse your existing SharePoint OAuth cred on the first node, and leave the download node’s auth on None since the url is already pre-signed. if that download link ever comes back empty (app-only auth does that), point that node at /sites/SITE_ID/drive/items/{{ $json.id }}/content with your cred attached instead.

after getting the file list, add a Filter node on file existing in the response (i.e. {{ $json.file }} is not empty) to automatically exclude subfolders from your loop, otherwise the download step will fail on folder items that sneak into the children response.