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 → Search operation enables you to search for files within a specified SharePoint site using a query string. This is useful for automating document management workflows, such as finding documents by name, metadata, or content, and integrating them into broader business processes.

Common scenarios:

  • Automating document retrieval based on keywords or metadata.
  • Building approval or review workflows that require fetching specific files.
  • Integrating SharePoint file searches with other systems (e.g., CRM, ERP).

Example:
You could use this node to automatically find all invoices containing the word "Q1" in their filename or content, and then process them further in your workflow.


Properties

Name Meaning
Site ID The identifier or name of the SharePoint site where the search will be performed. Options: Financial
Query The text string used to search for items. It matches across several fields including filename, metadata, and file content.

Output

The output is an array of JSON objects, each representing a file found by the search. Each object contains details about the file, such as:

{
  "id": "string",
  "name": "string",
  "webUrl": "string",
  "file": {
    "mimeType": "string",
    // ...other file properties
  },
  // ...additional metadata fields
}
  • Only items that are files (not folders) are included in the results.
  • The exact structure may include additional fields provided by the SharePoint API.

Dependencies

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

Troubleshooting

Common issues:

  • Invalid Site ID: If the Site ID is incorrect or the user does not have access, no results will be returned or an error may occur.
  • Empty Query: Providing an empty query may return no results or all files, depending on SharePoint's behavior.
  • API Permission Errors: Insufficient permissions in the connected Microsoft account can cause authentication or authorization errors.

Error messages:

  • "The ID you provided does not belong to a file." – This occurs if the search result includes non-file items, but the node filters these out, so you should only see files.
  • General API errors: These will be reported in the error field of the output if "Continue On Fail" is enabled.

Links and References

Discussion