OneDrive allows you to establish a connection with the Microsoft OneDrive service and enables the files list, download, upload and delete operations.

Take a look at the configuration parameters of the component:

  • Account: for the component to make the authentication of the OneDrive service, it's necessary to use an OAuth 2 account type of the Microsoft provider with at least the "offline_access" and "Files.ReadWrite.All" scope.

  • Operation: list, list search, pagination, list search, download, download by file ID, upload, delete.

  • Remote Directory: base remote directory, which can be relative (eg.: pub/tmp) or absolute (eg.: /root/pub). This parameter supports Double Braces.

  • Page Size: used in the list and list search operations, which refers to the amount of objects returned in the search.

  • Query: present in the list search operation. This parameter defines the type of search that will be made in the OneDrive directories. To know more about this filter, click here.

  • Next Page: present in the pagination operation.

IMPORTANT: if an OneDrive component that is executing the list or list search operation genertaes more results than Page Size, then a second OneDrive component can use the pagination operation and the Next Page parameter. It can occur manually or through Double Braces. Example: with {{ message. nextPage }}), more results of the previous operation will be shown.

  • File Name: file name or full file path. This parameter supports Double Braces.

  • Remote File Name: remote file name or relative path (eg.: tmp/file.txt) to the remote file. This parameter supports Double Braces.

  • File ID: unique identificator of a file.

  • Fail On Error: if the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

IMPORTANT: notice some of the parameters above support Double Braces. To understand how this language works, read our article by clicking here.

Messages flow

Output

When executing an OneDrive component by using the list and list search operations, the following JSON structure will be generated:

{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('user%40hotmail.com')/drive/root/children",
"count": 5,
"nextPage": "https://microsoft.graph/nextPage?token=Md",
"value": [
{
"createdDateTime": "2010-10-07T23:25:28.99Z",
"cTag": "adDpEOUMxOTZEMzdEMkQxNT42MzcyODc4NjU2Nzg0MDAwMUHDA",
"eTag": "aRDlfdseMTk2RDRfdfDJEMTU5RSExEuMA",
"id": "DXCC196D37D2D159E!161",
"lastModifiedDateTime": "2020-06-26T16:42:47.84Z",
"name": "Documents",
"size": 49378390,
"webUrl": "https://1drv.ms/f/s!AGG4VLX3T6sHZgSE",
"reactions": {
"commentCount": 0
},
"createdBy": {
"user": {
"displayName": "NAME",
"id": "d9c196d37d2d159e"
}
},
"lastModifiedBy": {
"user": {
"displayName": "NAME",
"id": "d9de396d37d2d159e"
}
},
"parentReference": {
"driveId": "d9c196d37d2d159e",
"driveType": "personal",
"id": "XCC196D37D2D159E!160",
"path": "/drive/root:a_folder"
},
"fileSystemInfo": {
"createdDateTime": "2010-10-07T23:25:28.99Z",
"lastModifiedDateTime": "2010-10-07T23:25:28.99Z"
},
"folder": {
"childCount": 6,
"view": {
"viewType": "thumbnails",
"sortBy": "name",
"sortOrder": "ascending"
}
},
"specialFolder": {
"name": "documents"
}
}
]
}

  • value[name]: folder or file name

  • value[size]: size in bytes

  • nextPage: url to see more results (check “pagination” operation)

Download operation:

{
"remoteDirectory": "REMOTE_DIRECTORY",
"remoteFileName": "remoteFileName"
"fileName": "file.ext",
"success": true
}

  • remoteDirectory: base remore directory path (relative or absolute)

  • remoteFileName: remote file path or remote file relative path

  • fileName: local file name

  • success: "true" if the operation was successful, "false" if otherwise

Download by file Id operation:

{
"fileId": "FILE_ID"
"fileName": "file.ext",
"success": true
}

  • fileId: unique identifier of the file

  • fileName: local file name

  • success: "true" if the operation was successful, "false" if otherwise

Upload operation:

{
"remoteFileName": "remote_file.ext",
"remoteDirectory": "Documents"
"fileName": "file.ext",
"success": true
}

  • remoteFileName: remote file path or remote file relative path

  • remoteDirectory: base remore directory path (relative or absolute)

  • fileName: local file name

  • success: "true" if the operation was successful, "false" if otherwise

Delete operation:

{
"fileId": "FILE_ID"
"success": true
}

  • fileId: unique identifier of the file

  • success: "true" if the operation was successful, "false" if otherwise

IMPORTANT: the manipulation of files inside a pipeline occurs in a protected way. The files becomes available in a temporary directory that only the pipeline under execution has access to.

To understand how the messages flow work in the Platform, click here and read our article.

Did this answer your question?