Microsoft Sharepoint icon

Microsoft Sharepoint

Consume Microsoft SharePoint API

Overview

The Microsoft SharePoint node for n8n allows you to interact with files stored in Microsoft SharePoint sites. Specifically, the File → Share operation enables you to generate a sharing link for a file, making it accessible to others either within your organization or anonymously, depending on your chosen settings.

Common scenarios:

  • Sharing documents with colleagues or external partners.
  • Automating the process of generating view/edit/embed links for files after upload or modification.
  • Integrating SharePoint file sharing into approval workflows or notifications.

Practical example:
After uploading a report to SharePoint, automatically generate an anonymous "view" link and send it via email to stakeholders.


Properties

Name Meaning
Site ID The identifier or name of the SharePoint site where the file is located.
File ID The unique identifier of the file you want to share.
Type The type of sharing link to create. Options:
- View (read-only access)
- Edit (edit permissions)
- Embed (for embedding in web pages)
Scope The scope of the sharing link. Options:
- Anonymous (anyone with the link can access)
- Organization (only people in your org can access)

Output

The output will be a JSON object containing the response from the SharePoint API's createLink endpoint. Typically, this includes details about the generated sharing link, such as:

{
  "link": {
    "type": "view",
    "scope": "anonymous",
    "webUrl": "https://..."
    // ...other metadata
  }
  // ...additional fields may be present
}
  • The most important field is usually link.webUrl, which is the actual URL that can be shared.

Dependencies

  • External Service: Requires access to Microsoft SharePoint Online.
  • Authentication: Needs valid OAuth2 credentials (microsoftSharepointOAuth2Api) configured in n8n.
  • n8n Configuration: Ensure the SharePoint OAuth2 credential is set up with appropriate permissions to read and share files.

Troubleshooting

Common issues:

  • Invalid Site ID or File ID: If these are incorrect, the node will fail to find the file and return an error.
  • Insufficient Permissions: The connected account must have permission to share the specified file.
  • API Errors: Errors from the SharePoint API (e.g., "Resource not found", "Access denied") will be returned in the output.

Error messages and resolutions:

  • "The ID you provided does not belong to a file."
    • Make sure the File ID refers to a file, not a folder or other resource.
  • "Access denied"
    • Check that your OAuth2 credentials have sufficient permissions for the target site and file.
  • "Resource not found"
    • Double-check the Site ID and File ID values.

Links and References

Discussion