Utilising OneDrive from Your Workflow

In this article I will explain an automated process associated with OneDrive.

Microsoft 365 OneDrive for Business is a cloud storage service for general companies provided by the Microsoft Corporation. You can use it for personal use, or you can create shared folders for multiple people to use. You can also use its API to perform various operations, and the automated Tasks we’ll discuss here are based on its API.

A Microsoft 365 Business account is required for Microsoft 365 OneDrive for Business. For more Information you can see the Microsoft 365 Business page. Regarding Microsoft 365 OneDrive for Business you can see its help page here.

About each automated Task

Automated Tasks related to Microsoft 365 OneDrive for Business include Upload File, Copy File/Folder, Create Folder, and Delete File/Folder. In this page, we will focus on three of them: Create Folder, Upload File, and Delete File/Folder.

First, we’ll briefly explain each Task.

Microsoft 365 OneDrive for Business: Create Folder

Microsoft 365 OneDrive for Business: Create Folder settings screen

Specify a folder on Onedrive and create a new folder in it. You can save the created folder’s ID and URL in Data Items.

Microsoft 365 OneDrive for Business: Upload File

Microsoft 365 OneDrive for Business: Upload File settings screen

Upload a file to OneDrive. You can specify the files to be uploaded in a File-type Data Item. By setting multiple files in a File-type Data Item you can simultaneously upload multiple files. You can specify the destination of the uploaded files with a Folder ID. If you don’t, the files are uploaded to the root folder of the User who uploads them. You can also save the URL of the uploaded file in a Data Item.

Microsoft 365 OneDrive for Business: Delete File / Folder

Microsoft 365 OneDrive for Business: Delete File / Folder settings screen

Specify a file and a folder on Onedrive to delete them. With String-type (multiple lines) Data Item, where you can write one URL per line to delete multiple files and folders at once.

To use these automatic Tasks, it is necessary to obtain a token linked to Microsoft 365 account from the OAuth2 Settings button in the Service Task. Follow the steps below to set it up.

How to Integrate OneDrive with Questetra

In the Microsoft 365 OneDrive for Business Tasks select the OAuth2 Settings button under C1: OAuth2 Settings Name.

Next, click the Add button and enter a suitable name in the “Name” field. It is recommended that you use something like “Connect with {account name of Microsoft 365}” so that you can easily identify the account to which it is connected.

If you click the Get Token button the login screen to your Microsoft 365 account will be displayed (but if you have already signed in to Microsoft 365 via the browser you are using, the “Sign in” screen is not displayed).

Enter your Microsoft 365 account (email address) and password to sign in to Microsoft 365.

There’s no need to choose Yes or No for “Stay signed in?”

If the authentication is successful we will return to the OAuth2 configuration page in Questetra and “o (Refresh token)” will be displayed in the “Have a Token?” field.

Sample App

Sample App created using automated Tasks of Microsoft 365 OneDrive for Business

This App is for sending files to people outside the company based on the premise that only one department within the company has installed Questetra BPM Suite. The method is to upload a file to a dedicated folder created in Shared libraries of OneDrive and let the external people access the folder. The URL of the folder is set to be shared with people outside the company by email. Also, the folders and the files in it are set to be deleted a day after it is created. This method is used for files that are too large to be sent by email or when there are multiple files in a folder.

You can set Data Items as follows:

Data Item NameData-typeRequired“Attach File” Task“Confirm URL” TaskDescription
TitleEditableDisplay onlyThe Title of the Process.
Created folder URLString-type (single line)No displayDisplay onlySave the URL of the folder created in the Microsoft 365 OneDrive for Business: Create Folder Task.
Upload fileFile-typeYesEditableDisplay onlySave the file to be uploaded and shared.
Data Item settings

First, specify the file to be shared in the “File Attachment” Task. In the following “Create Folder” Task (see Microsoft 365 OneDrive for Business: Create Folder) create a folder to be shared on OneDrive.

Item nameRequiredDescription
C1: OAuth2 Setting Name*YesTo specify OAuth2 settings to connect to OneDrive. In the OAuth2 settings, you need to get a token beforehand (see “How to Integrate OneDrive with Questetra”).
C2: Parent Folder URLTo specify in which folder you want to create the new folder using URL. If you don’t, the folder is generated in the root folder of My Drive. This time, select Fixed Value and specify the folder in the Shared libraries.
C3: Folder Name to create*YesTo specify the name of the folder to be created: let’s use “#{processInstanceId}” this time. The “#{processInstanceId}” part will contain the process ID, so that there will be no duplication with other folders created by this App.
C4: String type Data Item that will save Folder URLTo specify the Data Item for saving the generated Folder URL: this time, specify the created Folder URL.
Microsoft 365 OneDrive for Business: Create Folder settings

Next, upload the specified file to the created folder.

Item nameRequiredDescription
C1: OAuth2 Setting Name*YesTo specify OAuth2 settings to connect to OneDrive. In the OAuth2 settings you need to get a token beforehand (see “How to Integrate OneDrive with Questetra”).
C2: File type Data Item whose attached files will be uploaded*YesTo specify the Data Item that contains the file to be uploaded: specify “Upload File” this time.
C3: Folder URL files will be uploaded (Root folder if blank)To specify the Folder URL to save the uploaded file: this time, specify the Created folder URL.
C4: String type Data Item to save uploaded file URLsTo specify the destination of Data Items to save uploaded file URLs. It is not used this time.
Microsoft 365 OneDrive for Business: Upload File settings

When you have completed the settings, proceed to the “Confirmation of URL” Task, where you confirm the URL in the “Created folder URL” and inform the client. The function related to communication is not included, therefore you should inform them by e-mail or add automatic messaging Tasks.

Once confirmed, proceed to the Timer Intermediate Event.

Item nameDescription
Datetime specified by Data ItemTo specify the date and time to proceed to the next Data Item. It’s not used this time.
Datetime specified by an expressionTo specify the date and time to proceed with an expression. This time the expression “presenceInstanceStartDatetime.addDays(1)” is used.
Timer Intermediate Event settings

This will allow you to wait until one day after you start the process. The receiving party should receive the file during this time.

After one day, the folder will be deleted in the Delete Folder Task (see Microsoft 365 OneDrive for Business: Delete File / Folder).

Item nameRequiredDescription
C1: OAuth2 Setting Name*YesTo specify OAuth2 settings to connect to OneDrive. In the OAuth2 settings you need to get a token beforehand (see “How to Integrate OneDrive with Questetra”).
C2: Data Item with File / Folder URLs to delete*YesTo specify the Data Item containing the URLs of the file and the folder to be deleted: this time, specify the created Folder URL.
Microsoft 365 OneDrive for Business: Delete File / Folder settings

Once the folder is deleted the entire process is complete.

That’s all for today.

Discover more from Questetra Support

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top