Skip to main content

Upload File to SharePoint Using Microsoft Graph API

Workflow preview

Workflow preview
100%
Upload File to SharePoint Using Microsoft Graph API preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n workflow template allows you to upload a photo to a SharePoint folder using the Microsoft Graph API. The workflow includes steps for authentication, retrieving a photo for testing purposes...

Best for

  • File Management automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.manualtrigger, n8n-nodes-base.httprequest, n8n-nodes-base.set, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Greg Evseev.

Original n8n.io source

1.1 Workflow description

Title
Upload File to SharePoint Using Microsoft Graph API
Workflow name
Upload File to SharePoint Using Microsoft Graph API

This n8n workflow template allows you to upload a photo to a SharePoint folder using the Microsoft Graph API. The workflow includes steps for authentication, retrieving a photo for testing purposes, setting the destination folder and file name, and uploading the photo.

Who is this for?

This workflow is ideal for users who need to automate the process of uploading images to SharePoint. It is particularly useful for developers, IT administrators, and anyone managing digital assets within a SharePoint environment.

What problem is this workflow solving? / Use Case

This workflow addresses the need to automate the uploading of photos to a specific SharePoint folder. By using the Microsoft Graph API, it ensures secure and efficient file management, reducing manual effort and potential errors.

What this workflow does

  1. Trigger the Workflow: The workflow starts when the user clicks the 'Test workflow' button.
  2. Set Configuration: Sensitive data such as TENANT_ID, CLIENT_ID, and CLIENT_SECRET are set.
  3. Authentication: Obtains an access token from Microsoft Graph API using the provided credentials.
  4. Get Photo: Retrieves a sample photo from a URL for testing purposes.
  5. Set Destination: Sets the target folder and file name for the photo upload.
  6. Upload Photo: Uploads the photo to the specified SharePoint folder using the Microsoft Graph API.

Setup

Prerequisites

  1. Create an Application User: Follow this guide to create an application user.
  2. Set Permissions: Ensure the following permissions are set:
    • Sites.ReadWrite.All: For SharePoint site access.
    • Files.ReadWrite.All: For file upload operations.

Authentication

For successful authentication, provide the following:

  • TENANT_ID
  • CLIENT_ID
  • CLIENT_SECRET

Note: For demonstration purposes, these values are stored in a 'Set' node. In a production environment, ensure the safety of such data using credentials, secure vaults, or other safe methods.

Set Destination

The destination is defined by two parameters:

  • TARGET_FOLDER: The folder path in SharePoint where the photo will be uploaded.
  • FILE_NAME: The name of the file to be uploaded.

Example:

  • Desired file location: https://contoso.sharepoint.com/uploads/pictures from n8n/example.jpg
  • Set the following:
    • TARGET_FOLDER = /uploads/pictures from n8n
    • FILE_NAME = example.jpg

How to Customize This Workflow to Your Needs

  1. Update Sensitive Data: Replace the placeholder values for TENANT_ID, CLIENT_ID, and CLIENT_SECRET with your actual credentials.
  2. Change Destination: Modify the TARGET_FOLDER and FILE_NAME parameters to match your desired upload location and file name.
  3. Test with Different Photos: Update the URL in the 'Get Photo' node to test with different images.

Sticky Notes

Workflow Overview

This sticky note explains the overall purpose and dependencies of the workflow.

Authentication Details

This sticky note provides details on the authentication process and the importance of securing sensitive data.

Set Destination Details

This sticky note explains how to set the destination folder and file name for the photo upload.

By following these guidelines, you can easily customize and use this workflow to automate photo uploads to SharePoint using the Microsoft Graph API.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When clicking ‘Test workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 2 - Upload photo

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 3 - Set config (sensitive data)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 4 - Get photo (for testing purposes)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 5 - Set destination

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Authentication

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

3. Summary Table

Workflow Upload File to SharePoint Using Microsoft Graph API
Complexity intermediate
Nodes 9
Categories File Management
Author Greg Evseev
Published 24 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3690/3690.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Upload File to SharePoint Using Microsoft Graph API do?

This n8n workflow template allows you to upload a photo to a SharePoint folder using the Microsoft Graph API. The workflow includes steps for authentication, retrieving a photo for testing purposes...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your File Management use case.