Upload a File to a Folder

Uploads a file to a given SharePoint document library using the Microsoft Graph API.

Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

upload the file to the folder and get the file reference

What does it do? This is the base syntax for the procedure.

Where does it go? This phrase should be written on a new line.

Is it required? ✅ Yes — This phrase is required in the syntax.

Does it require input data? ✅ Yes — The document library folder where the file will be uploaded must be specified for the folder and the content of the file to be uploaded as bytes must be specified for the file.

the file name is

What does it do? Specifies the name of the file to be uploaded.

Where does it go? This phrase should be indented beneath upload the file to the folder and get the file reference

Is it required? ✅ Yes — This phrase is required in the syntax.

Does it require input data? ✅ Yes — A text value should be specified as the name of the file to be uploaded.

Example: the file name is "file name"

the conflict behavior is

What does it do? Specifies the behavior when a conflict occurs. Possible values are 'fail', 'replace', 'rename'.

Where does it go? This phrase should be indented beneath upload the file to the folder and get the file reference

Is it required? 🌟 No — This phrase is optional in the syntax.

Does it require input data? ✅ Yes — A text value should be specified as the behavior when a conflict occurs. Possible values are 'fail', 'replace', 'rename'.

Example: the conflict behavior is "replace"

Default: rename

Examples

1. Upload a file named "My File.txt" to the folder "My Folder"

get a folder at "/My Site/My Documents/My Folder"
use the above as the folder
the new file
upload the new file to the folder
        the file name is "My File.txt"

Last updated

Was this helpful?