Microsoft Sharepoint icon

Microsoft Sharepoint

Consume Microsoft SharePoint API

Overview

The Microsoft SharePoint - File Download node allows you to download a file from a specified SharePoint site using its File ID. The downloaded file is attached as binary data to the output, making it suitable for workflows where you need to retrieve documents or files stored in SharePoint and process them further (e.g., send via email, archive, or analyze).

Common scenarios:

  • Automating document retrieval from SharePoint for backup or reporting.
  • Integrating SharePoint-stored files into other business processes.
  • Fetching files for review, approval, or distribution.

Example:
Download a financial report PDF from a SharePoint site and send it as an email attachment.


Properties

Name Meaning
Site ID Site ID or site name. Options include:
- Financial (1470e487-faf2-4986-a59f-843f671f765c,450b8bf9-e982-463d-b732-b74763884f0f)
File ID The unique identifier of the file to download from SharePoint.
Binary Property Name of the binary property to which to write the data of the read file (default: data).

Output

  • Binary Data:
    The node outputs the downloaded file as binary data under the property name specified by "Binary Property".
    • The binary object includes metadata such as filename and MIME type.
    • The original JSON input is preserved in the output's json field.

Example output structure:

{
  "json": { /* original input data */ },
  "binary": {
    "data": {
      "data": "<base64-encoded file content>",
      "fileName": "example.pdf",
      "mimeType": "application/pdf"
    }
  }
}

If an error occurs (such as providing a non-file ID), the output will contain an error message in the json field:

{
  "json": {
    "error": "The ID you provided does not belong to a file."
  }
}

Dependencies

  • External Service: Microsoft SharePoint (requires access to the relevant site and file).
  • Credentials:
    • Requires n8n credentials of type microsoftSharepointOAuth2Api.
  • n8n Configuration:
    • Ensure the OAuth2 credential is set up with appropriate permissions to read files from SharePoint.

Troubleshooting

Common Issues:

  • Invalid File ID:
    If the provided File ID does not correspond to a file (e.g., it's a folder or invalid), the node returns:
    "The ID you provided does not belong to a file."
    Resolution: Double-check the File ID and ensure it points to a valid file.

  • Missing Permissions:
    If the connected account lacks permission to access the file/site, the node may throw authentication or authorization errors.
    Resolution: Verify that the OAuth2 credentials have sufficient permissions.

  • Incorrect Binary Property Name:
    If the "Binary Property" is not set or mismatched, the binary data may not be accessible as expected.
    Resolution: Use the default value (data) or ensure consistency across your workflow.


Links and References

Discussion