When a file is created Trigger in OneDrive For Business Connector.(Power Automate Cloud flows)

11/08/2023

Japanese version.

This trigger is launched when a new file is created in a designated folder on OneDrive.

This trigger retrieves the contents and some properties of a newly created file.

Note that the following files are ignored.

  • File name only file. Files with a file size of 0 bytes.
  • Files with a file size greater than 50 MB.
  • Files that have been moved within OneDrive.

Fewer properties are retrieved than the "When a file is created(properties only)" trigger, but in many cases "When file is created" is sufficient.

If the following items are required, they must be completed in "Get file metadata".

  • File size
  • Last Modified
  • Last updated by

How to use

Click on "Create" then "Automated cloud flow".

Specify any name for "Flow name" and select "When a file is created".

When both are specified, "Create" will change color and click on it.

Set parameters.

Parameters.

Folder

Specify the folder to be detected.

When selected, it looks like a folder path, but it is only a display and the substance is an ID.

If you delete the specified folder and then create a folder with the same name, it will be treated as a different folder.
In such a case, an error will occur that the folder does not exist, so it must be re-specified in the flow.

Include subfolders

  • No…Only the specified folders will be detected.
  • Yes…Folders below the specified folder will also be detected.

If not necessary, "No" is recommended.

Infer Content Type

The "File Content Types" section of the Dynamic Content section explains.

Dynamic contents

File content

File Content. Used for file creation and email attachments.

File identifier

Equivalent to the "ID" of the "When a file is created(properties only)" trigger.

It can be used for an ID that specifies a file in the following actions.

It is also available in the "Get file content" action, but it makes no sense since the file contents have already been retrieved.

File name

Equivalent to the base64-encoded "Name" of the "When a file is created(properties only)" trigger.

When processed with an expression, it becomes "Name without extension".

Use substring, base64ToString, and indexOf.

substring(base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded']), 0 ,indexOf( base64ToString(triggerOutputs()?['headers/x-ms-file-name-encoded']),'.' ) )

File path

Equivalent to the base64-encoded "Path" of the "When a file is created(properties only)" trigger.

When processed with an expression, it becomes Folder Path.

Use substring, base64ToString, and lastIndexOf.

substring( base64ToString( triggerOutputs()?['headers/x-ms-file-path-encoded']), 0, lastIndexOf( base64ToString( triggerOutputs()?['headers/x-ms-file-path-encoded']) , '/' ) )

File entity tag

Equivalent to the "ETag" of the "When a file is created(properties only)" trigger.

It will be used infrequently.

File content type

MIME type. It will be used infrequently.

Equivalent to the "Media type" of the "When a file is created(properties only)" trigger.

If "Infer Content Type" is set to "No", it is fixed at "application/octet-stream".

If "Infer Content Type" is set to "Yes", it is guessed from the file.

---

Links

OneDrive For Business Connector(Power Automate Cloud flows)