

Hi there.
In a consultation with a customer I verified if I can output files to OneDrive via API, and confirmed that it can be achieved.
Below, I will summarize how to set up the collaboration.
2: Settings for linking OneDrive and Questetra
2.1: OAuth settings on the OneDrive (Office 365) side
2.2: OAuth settings on the Questetra side
2.3: Settings for invoking OneDrive APIs from Questetra
3: Summary
1: Background to considering the collaboration between OneDrive and Questetra
As an output to online storage Google Drive is equipped on Questetra as the standard function. Also, we provide Add-on XML (which you can import to Questetra) for output to Box or Dropbox. But there is not one for OneDrive yet, so I looked into this.
* Related Manual: M229: Auto Backup to Google Drive
* Related Add-on: Upload to Box
* Related Add-on: Upload to Dropbox
2: Settings for linking OneDrive and Questetra
There is an article I have summarized before regarding collaboration between Office 365 including OneDrive.
* Related Article: How to Cooperate between Office 365 and Cloud Based Workflow
As I describe in that article, concerning authentication, the Questetra side can only support the OAuth2 settings if you use the Authorization Code in Azure AD v2.0 endpoint. If I could not use that method, it would have been a bit troublesome, but in this case it was okay.
Please refer to the following article for details of the OAuth2 settings. In this article, I will describe things specific to cooperation with OneDrive.
Related Article: Settings when Calling REST API of Another Service from Questetra (Questetra to be OAuth2 client)
2.1: OAuth settings on the OneDrive (Office 365) side
Start by adding an app on the “My application” screen.

- Type anything you want for Application Name
- Ignore Guided Setup, and click on Create.

- Make a note of the Application Id.
- In Application Secrets, select Generate New Password, and make a note of the password.
- In Platforms, click Add Platform and select Web, then set Questetra’s callback URL as the Redirect URL.
- In Microsoft Graph Permission – Delegated Permission, click Add and add Files.ReadWrite. And then “Save” at the bottom.
* It seems that you can set various other things here, so compared with other services, it is rather complicated as an OAuth application registration screen, isn’t it?
Reference Article: Microsoft Graph permissions reference
2.2: OAuth settings on the Questetra side
Set up the followings, then get the token.
- Authorization Endpoint URL:https://login.microsoftonline.com/questetrainc.onmicrosoft.com/oauth2/v2.0/authorize
- Token Endpoint URL:https://login.microsoftonline.com/questetrainc.onmicrosoft.com/oauth2/v2.0/token
- Scope: https://graph.microsoft.com/Files.ReadWrite offline_access
- Client ID, Consumer Secret: Respectively enter the Application Id and Application Secrets (password) which you have obtained during the application registration in 2.1 above.
2.3: Settings for invoking OneDrive APIs from Questetra
Output was accomplished by using a Throwing Message Intermediate Event (HTTP), .
* Related Manual: M225: Auto Sending of HTTP Request with Business data Inserted

- Network Settings
- Access URL: https://graph.microsoft.com/v1.0/me/drive/items/{FOLDER ID}:/{FILENAME}:/content
- If you specify “root” in the folder ID, it is output under the default folder of the authenticated user
- Assuming practical settings, it is better to embed Data Items into folder IDs and filenames since they are supposed to vary.
- HTTP Method: PUT (Specify Request Body)
- “String type data item that will contain error details when an error occurred”: Although it is not mandatory, it is better to specify it so that you can check the error details. Also, it is good to check the data item after this event to determine whether there is an error, and to take action at the time of error.
- Access URL: https://graph.microsoft.com/v1.0/me/drive/items/{FOLDER ID}:/{FILENAME}:/content
- Security / Custom Header: Select “Connect with the OAuth 2.0” and enter the name which you have set above 2.2 in “Setting name”
- Request Body: St the File-type Data Item that stores the files to be sent to OneDrive in “Data item to send as request body”
- “Response Settings”: Although it is not mandatory, if you check “Save Response” and specify a String type Data Item, you can confirm the result.
* Reference Article: Upload or replace the contents of a DriveItem
3. Summary
Even though it is not possible to prepare an Add-on XML (to import and to use), hopefully you now understand that you can connect file output to OneDrive with just a few settings.
If you have any question, please feel free to contact us.
Pingback: Examples of Collaborations with Other Systems and BPM Workflow (June, 2019) - Questetra
Pingback: Application Registration Procedure in Office 365 for Linking Office 365 and Questetra Cloud Workflow with API – Questetra Support
Pingback: How to Output Data to Excel Online From the Cloud-based Workflow Questetra (API Integration Setting Procedure) – Questetra Support
Pingback: How to Start Cloud BPM Workflow Questetra Operations from Outlook Scheduler (Microsoft Power Automate integration/API integration) – Questetra Support
Pingback: How to Add an Event to an Outlook Calendar from the Cloud BPM Workflow Questetra (API Integration Setup Procedure) – Questetra Support