Skip to main content

Upload file

Upload a local file of any size to a OneDrive or SharePoint folder path; creates or replaces it. Files over 4 MB go through a resumable upload session in chunks.

Command in the Microsoft 365 toolkit · id ooa.microsoft365/upload_file · 7 inputs (2 required), 3 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
Access tokenCredentialNoMicrosoft Graph access token from the vault; or leave it empty and choose a connection that signs in, which gets and renews the token.
Local pathFileYesFile to upload.
Remote pathStringYesTarget path in the drive, including the file name; ending with / it is a folder and the file keeps its name (G3).
If existsStringNoreplaceWhen the name is taken at the destination: fail, rename (add a number) or replace.
DriveStringNome/driveWhose files: me/drive (your OneDrive), a person (ann@acme.com), a SharePoint site (contoso.sharepoint.com:/sites/Finance), a library of a site by name (contoso.sharepoint.com:/sites/Finance:/Invoices), or sites/{site-id}/drive or drives/{drive-id}. With an app sign-in, name a person or site.
Endpoint addressStringNohttps://graph.microsoft.com/v1.0Graph endpoint; change only for national clouds or testing.
Chunk size (MB)NumberNo10Size of each piece sent for files over 4 MB (rounded down to a multiple of 320 KB); smaller pieces suit slow or unreliable networks.

Outputs​

OutputTypeWhat it is
item_idStringDrive item id.
web_urlStringLink to the file.
sizeNumberBytes uploaded.