Overview
The Smartgent SharePoint node enables interaction with Microsoft SharePoint document libraries via the Microsoft Graph API. It supports operations to list documents in a library, retrieve detailed metadata of a specific document, and download the content of a document.
This node is beneficial when automating workflows that involve managing or processing files stored in SharePoint, such as:
- Automatically retrieving lists of documents for reporting or auditing.
- Fetching metadata details for specific documents to integrate with other systems.
- Downloading document contents for further processing, backup, or distribution.
Example use cases:
- A workflow that lists all documents in a SharePoint library and filters them based on custom criteria.
- Retrieving metadata of a document by its ID to check its properties before processing.
- Downloading a document file from SharePoint to attach it to an email or upload it to another service.
Properties
| Name | Meaning |
|---|---|
| Operation | The action to perform. Options: List Documents, Get Document Details, Download Document. |
| Document Library Path | (For List Documents) The path to the document library or folder. Use / for the root Documents library or specify a subfolder path. |
| Document ID | (For Get Document Details and Download Document) The unique identifier of the document to retrieve or download. |
| Additional Options | Optional parameters to refine queries when listing documents: - Filter: OData filter expression to filter documents (e.g., name eq 'document.pdf').- Select Fields: Comma-separated list of fields to include in the response. - Top: Maximum number of items to return (1 to 1000). |
Output
For List Documents operation:
- JSON output contains:
operation:"listDocuments"siteId: SharePoint site identifierdriveId: Drive identifier within the sitelibraryPath: The requested document library pathdocuments: Array of document objects, each including fields likeid,name,lastModifiedDateTime,size,webUrl,downloadUrl, andmimeTypetotalCount: Number of documents returnedtimestamp: ISO timestamp of the operation
- JSON output contains:
For Get Document Details operation:
- JSON output contains:
operation:"getDocument"siteId,driveId,documentIddocument: Object with detailed metadata about the document (e.g.,id,name,lastModifiedDateTime,size,webUrl,downloadUrl,mimeType,createdDateTime,lastModifiedBy,createdBy)timestamp
- JSON output contains:
For Download Document operation:
- JSON output contains:
operation:"downloadDocument"siteId,driveId,documentIdfileName: Name of the downloaded filetimestamp
- Binary output contains:
data: Base64 encoded content of the downloaded documentmimeType: MIME type of the document (defaulted toapplication/octet-streamif unknown)fileName: Original file name
- JSON output contains:
Dependencies
- Requires an API key credential with permissions to access Microsoft Graph API for SharePoint.
- Needs configuration of:
- Tenant ID
- Client ID
- Client Secret
- Site URL of the SharePoint instance
- Uses Microsoft Graph API endpoints to authenticate and interact with SharePoint sites, drives, and documents.
- The node internally handles OAuth2 client credentials flow to obtain access tokens.
Troubleshooting
Authentication errors:
- Messages like "Authentication failed: Invalid client credentials" indicate incorrect tenant ID, client ID, or client secret.
- Verify credentials and ensure the app registration has appropriate Microsoft Graph API permissions.
Invalid SharePoint site URL format:
- If the site URL is malformed or not accessible, the node will throw an error.
- Ensure the site URL is correct and accessible with the provided credentials.
No drives found for the site:
- Indicates the specified SharePoint site does not have any document libraries accessible.
- Confirm the site URL and permissions.
Document not found or invalid document ID:
- When fetching or downloading a document, an invalid or non-existent document ID will cause failure.
- Double-check the document ID value.
Rate limits or API errors from Microsoft Graph:
- The node surfaces HTTP errors from the API.
- Implement retry logic or handle failures gracefully using the node's "Continue On Fail" option.