Outlook Groups icon

Outlook Groups

Interact with Microsoft Outlook Groups and SharePoint

Overview

The SharePoint Upload Attachments operation in this node allows users to upload multiple files (attachments) to a specified SharePoint document library folder. This is particularly useful when automating workflows that involve saving email attachments, form uploads, or any batch of files into SharePoint for centralized storage and collaboration.

Typical use cases include:

  • Automatically saving email attachments from Microsoft 365 groups to SharePoint.
  • Uploading multiple documents collected from various sources into a SharePoint folder.
  • Archiving files generated by other systems into SharePoint document libraries.

For example, you might receive several attachments from an incoming email and want to store all of them in a SharePoint folder named "Documents/Attachments" while optionally adding timestamps to filenames to avoid overwriting existing files.


Properties

Name Meaning
SharePoint Site The SharePoint site where the files will be uploaded.
Document Library The document library (drive) within the selected SharePoint site where files will be stored.
Folder Path The path inside the document library folder where files will be uploaded (e.g., "Documents/Attachments").
Overwrite Existing Whether to overwrite files with the same name if they already exist in the target folder.
Add Timestamp to Filename Optionally add a timestamp suffix to each filename to prevent naming conflicts during upload.
Attachments A JSON array of attachment objects, each containing name (filename) and contentBytes (file content in base64 or Buffer).

Output

The output is an array of results, one per attachment attempted to upload. Each result object contains:

  • name: The final filename used for the upload (with sanitization and optional timestamp).
  • originalName: The original filename provided in the input.
  • success: Boolean indicating whether the upload succeeded.
  • sharePointId: The unique ID of the uploaded file in SharePoint (if successful).
  • webUrl: The URL to access the uploaded file in SharePoint.
  • size: Size of the uploaded file in bytes.
  • error: Error message if the upload failed.

This structured output allows downstream nodes or workflows to handle success/failure cases individually for each attachment.


Dependencies

  • Requires a valid connection to Microsoft Graph API with permissions to access SharePoint sites and document libraries.
  • An API authentication token or credential configured in n8n to authorize requests to Microsoft Graph.
  • The node uses Microsoft Graph endpoints to interact with SharePoint sites, drives, and files.

Troubleshooting

Common Issues

  • Invalid JSON for Attachments: If the attachments property is not a valid JSON array, the node throws an error. Ensure the JSON is correctly formatted.
  • Missing Required Fields: Each attachment must have both name and contentBytes. Missing either causes that attachment to fail.
  • File Size Limits: Files larger than 4 MB are uploaded using a chunked upload session. Network interruptions or permission issues may cause failures here.
  • Permission Errors: Insufficient permissions on the SharePoint site or document library will cause API errors.
  • Filename Conflicts: If overwrite is false and a file with the same name exists, the upload will fail unless addTimestamp is enabled.

Error Messages

  • "Attachments must be valid JSON array": The attachments input is malformed; fix the JSON format.
  • "Missing contentBytes or name": One or more attachments lack required properties.
  • API errors from Microsoft Graph typically include HTTP status codes and messages; check credentials and SharePoint permissions.
  • "No binary data found": For related operations expecting binary input, ensure previous nodes provide binary data.

Links and References


Summary

This node operation efficiently uploads multiple attachments to SharePoint document libraries, handling filename sanitization, optional timestamping, and large file chunked uploads. It outputs detailed results per file, enabling robust automation scenarios involving SharePoint file management.

Discussion