Skip to content

Upload file to SharePoint

The “Upload file to SharePoint” service task stores a file in a specified SharePoint folder. If the folder does not exist, it is created automatically. You can optionally overwrite the original filename.

Input parameters

Provide the following fields as task input:

{
  "credentials": {
    "tenantId": "b0e1b1b0-1b1b-1b1b-1b1b-1b1b1b1b1b1b",
    "oAuthClientID": "1b1b1b1b-1b1b-1b1b-1b1b-1b1b1b1b1b1b",
    "clientSecret": "1b1b1b1b-1b1b-1b1b1b1b1b1b"
  },
  "sharepoint_access": {
    "webUrl": "https://example.sharepoint.com/sites/demo",
    "pathToFolder": "Documents/Invoices"
  },
  "file_reference": "s3://bucket-name/path-to-file.pdf",
  "overwrite_filename": "Invoice_12345.pdf"
}

Explanation:

  • credentials: Authentication details for Microsoft SharePoint.
  • sharepoint_access: Web URL and folder path that receives the upload.
  • file_reference: File reference (e.g., from an S3 bucket).
  • overwrite_filename: Optional new filename.

Output

The task returns the upload status.

{
  "success": true
}
  • success: Indicates whether the upload was successful (true or false).

JSONata examples

{
  "sharepoint_access": {
    "webUrl": "https://example.sharepoint.com/sites/{{$.project.name}}",
    "pathToFolder": "Documents/{{$.invoice.customerId}}/2024"
  },
  "file_reference": "{{$.attachments.invoice}}",
  "overwrite_filename": "Invoice_{{$.invoice.number}}.pdf"
}

Notes

  • The task creates the destination folder automatically if it does not exist yet.
  • Ensure that the SharePoint credentials are valid.
  • Without overwrite_filename the original filename is kept.

Tip

Test JSONata expressions in the JSONata Playground before using them in the process.