How to Output Files from Cloud-based Workflow Questetra to OneDrive

Hi, there.

By consultation from a customer, I verified if I can output files to OneDrive via API, and confirmed that it can be realized.
Below, I will summarize how to set up the collaboration.

1: Background to consideration of collaboration between OneDrive and Questetra
2: Settings for collaborating OneDrive and Questetra
  2.1: OAuth setting on the OneDrive (Office 365) side
  2.2: OAuth setting on the Questetra side
  2.3: Setting for invoking OneDrive APIs from Questetra
3: Closing

1: Background to consideration of collaboration between OneDrive and Questetra

As an output to online storage, first of all, output to Google Drive is equipped on Questetra as the standard function. Also, we publish 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 did a verification.
* Related Manual: M229: Auto Backup to Google Drive
* Related Add-on: Upload to Box
* Related Add-on: Upload to Dropbox

2: Settings for collaborating 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 this article, concerning authentication, Questetra side can support only with OAuth 2 setting if you use Authorization Code in Azure AD v2.0 endpoint. If I could not use that method, it would have been a bit troublesome, but this case it was okay.

Please refer to the following article for details of setting OAuth 2. In this article, I will describe things specific to the cooperation with OneDrive.
Related Article: Settings when Calling REST API of Another Service from Questetra (Questetra to be OAuth2 client)

2.1: OAuth setting on the OneDrive (Office 365) side

Start adding an app on “My application” screen.

  • Type any string for “Application Name”
  • Ignore “Guided Setup”, and click on “Create”.
  • Make a note of “Application Id”.
  • At “Application Secrets”, select “Generate New Password “, and make a note of the password.
  • At “Platforms”, “Add Platform” and select “Web”, then set Questetra’s callback URL into “Redirect URL”.
  • At “Microsoft Graph Permission” – “Delegated Permission”, click “Add” and add “Files.ReadWrite”. And then “Save” at the bottom.

* It seems that you can set variously here, so compared with other services, it is rather complicated as an OAuth application registration screen, is not it?

Reference Article: Microsoft Graph permissions reference

2.2: OAuth setting on the Questetra side

Set up the followings, then get token.

2.3: Setting for invoking OneDrive APIs from Questetra

By using “Throwing Message Intermediate Event (HTTP)”, output was accomplished.
* Related Manual: M225: Auto Sending of HTTP Request with Business data Inserted

  • “Network Settings”
    • “Access URL”:{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 so that you can check the error details. It is even better to configure processing upon an error after this event, that refers to this Data Item to determine the presence or absence of an error.
  • “Security / Custom Header”: Select “Connect with the OAuth 2.0” and enter the name which you have set at 2.2 above to “Setting name”
  • “Request Body”: Specify the File type Data Item that stores files to be sent to OneDrive to “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

* In the current specification (as of Ver. 11.9.0), in script processing, the number of characters of the HTTP header is limited to 1000 characters (there is no restriction on “Trowing Message Intermediate Event (HTTP)”). Meanwhile, Microsoft’s tokens exceed 1000 characters in many cases. For this reason, we cannot make this process into an Add-on XML at present.

3. Closing

Even though we are not possible to prepare an Add-on XML (to import and to use), I suppose you now understand that you can connect file output to OneDrive with just some settings.

If you have any question, please feel free to contact us.

%d bloggers like this: