OneDrive

OneDrive



OneDrive

Prerequisites:

  1. Azure AD instance with access details.
  2. Appropriate user (Delegated) permissions. For more information, refer Microsoft Documentation as mentioned in references below.


References:

  1. For information on application setup and refresh token refer Microsoft documentation link https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app#register-an-application


Refresh Token for connection to OneDrive

In One Drive Plugin Connection Configuration we need to provide connectivity details for a -OneDrive instance as mentioned in the table below.

Connection Details:

No.

Field Name

Datatype

Mandatory?

Description

1

Refresh Token 

String

Yes

Refresh Token provided by authorization grant flow discussed in sections below

2

Test Connection

Button

--

Verifies whether the connection is established or not.


Following are the steps for generating refresh token for OneDrive plugins, 

  1. Register app for OneDrive on Azure AD (Refer Appendix 17: OneDrive Refresh Token: Register app for OneDrive on Azure AD:)
  2. Generate Refresh Token for OneDrive ( Refer Appendix 17: OneDrive Refresh Token: Generate Refresh Token for OneDrive)



Get OneDrive Folder or File - Path

Folder or File – Path/ID is required in most OneDrive Plugin steps. Refer Appendix 18: OneDrive Folder/File - Path  to get Path.



OneDrive Plugin steps are discussed below,


Delete File Or Folder


Prerequisite Permissions:

For Delete File or Folder on OneDrive following Microsoft Graph permissions are required.


Permission type

Permission (from least to most privileged)

Delegated (work or school account)

Files.ReadWrite, Files.ReadWrite.All



References:

  1. For Delete File Or Folder on OneDrive refer document,

https://docs.microsoft.com/en-us/graph/api/driveitem-delete?view=graph-rest-1.0&tabs=http


Description

One Drive: Delete File or Folder plugin step deletes a file or folder on OneDrive.


Configurations 

Configuration:

No.

Field Name

Description

1

Step Name

Name of the step.  This name has to be unique in a single workflow.


Connection:


2

Checkbox: Accept value as variable/static

Leave checkbox unchecked to accept Refresh Token* value from a field - in the previous steps of the stream using a drop down list.  

Else enable checkbox for Refresh Tokenfield to appear as Text box.

3

Refresh Token

Generate and specify Refresh Token as detailed in Appendix 17: OneDrive Refresh Token.

The data type is String. This field is mandatory.


If checkbox above is enabled Password field appears as Text box (enter static value or environment variable). Else if checkbox above is disabled Password field appears as a drop down to select fields from previous steps.

4

Button: Test Connection

Verifies whether the connection is established or not.


Input Tab:

No.

Field Name

Description


Input Fields:


1

File or Folder ID/ Path

Provide OneDrive file/folder ID or path to delete file or folder. 

The field data type is String. This is mandatory.


To delete a folder in root specify Documents/

Else to delete a file/folder in any other path - Get OneDrive Path/ID as described in sections -

  1. Refer Appendix 18: OneDrive Folder/File - Path: Get Folder Path Get Folder Path
  2. Refer Appendix 18: OneDrive Folder/File - Path: Get File Path

  3. (You can use the ‘Upload File’ step to get Folder/File ID as an output of step execution).


e.g. If OneDrive path == https://organization-my.sharepoint.com/personal/xyz/Documents/demofolder/File.xlsx

Then provide, 

  1. Documents/demofolder/File.xlsx
  2. demofolder/File.xlsx





Download File


Prerequisite Permissions:

For Download File on OneDrive the following Microsoft Graph permissions are required.


Permission type

Permission (from least to most privileged)

Delegated (work or school account)

Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All





References:

  1. For Download File on OneDrive refer document.

https://docs.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http

  1. For File conversion refer Microsoft documentation.

https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get_content_format?view=odsp-graph-online


Description

One Drive: Download File step downloads a file on OneDrive.


Configurations 

Configuration:

No.

Field Name

Description

1

Step Name

Name of the step.  This name has to be unique in a single workflow.


Connection:


2

Checkbox: Accept value as variable/static

Leave checkbox unchecked to accept Refresh Token value from a field in the previous steps of the stream using a drop down list. 

Else enable checkbox for Refresh Token field to appear as Text box.

3

Refresh Token

Generate and specify Refresh Token as detailed in Appendix 17: OneDrive Refresh Token.

The data type is String. This field is mandatory.


If checkbox above is enabled Password field appears as Text box (enter static value or environment variable). Else if checkbox above is disabled Password field appears as a drop down to select fields from previous steps.

4

Button: Test Connection

Verifies whether the connection is established or not.


Input Tab:

No.

Field Name

Description


Input Fields:


1

OneDrive File ID/Path

Provide OneDrive file ID or path to download file. 

The field data type is String. This is mandatory.


Simply specify filename if it is to be downloaded from root (i.e. Documents/) 

Else to download a file in any other path - Get OneDrive Path/ID as described in sections -

  1. Get File PathRefer Appendix 18: OneDrive Folder/File - Path:  Get File Path 

  1.  (You can use the ‘Upload File’ step to get Folder/File ID as an output of step execution).


e.g. If OneDrive path is - https://organization-   my.sharepoint.com/personal/xyz/Documents/demofolder/File.xlsx

Then, provide 

  1. Documents/demofolder/File.xlsx or 
  2. demofolder/File.xlsx

2

Output Folder Path

Specify the folder to store the downloaded file.

The field data type is String. This is mandatory.

3

Browse

On click of this button brings up the dialog to select the output folder path. 

4

Convert In Format

Specify the format in which the file is to be downloaded. The field data type is String. 


For Supported file conversions refer URL mentioned in References.


Note: There are many supported file formats mentioned in Microsoft documentation. The following formats have been tested with expected results.


Supported source extensions for ''pdf''

Supported source extensions for ''jpg''

Supported source extensions for ''html''

doc, docx, epub, eml, htm, html, md, msg, odp, ods, odt, pps, ppsx, ppt, pptx, rtf, tif, tiff, xls, xlsm, xlsx.

bmp, jpeg, jpg, png.


eml, md, msg.




5

Delete Output Folder Contents Before Downloading  

Specify from the allowed values: Yes/No.

The field data type is String. This is mandatory.

6

Add DateTimeStamp For Duplicate File

Specify from the allowed values: Yes/No.

The field data type is String. This is mandatory.

7

Add File To Result

Specify from the allowed values: Yes/No. 

Specify Yes to make the file available for download on AutomationEdge server (through Requesuts menu) after workflow execution.

The field data type is String. This is mandatory.

8

Width

Provide the width of output JPG image (JPG width). 

This field is mandatory for conversion to jpg. The field data type is String. 

9

Height

Provide the height of output JPG image (JPG width). 

This field is mandatory for conversion to jpg. The field data type is String. 


Input Tab:

No.

Field Name

Description


Input Fields:


1

File Overwritten?

Provide output field name to hold the value for file overwritten (Yes/No). Default is ‘FileOverwritten’. The field data type is String.



Upload File

Prerequisite Permissions:

For Upload File step on OneDrive the following Microsoft Graph permissions are required.


Permission type

Permission (from least to most privileged)

Delegated (work or school account)

Files.ReadWrite, Files.ReadWrite.All



Referencs:

  1. For Upload File on OneDrive refer document.
  2. https://docs.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0

  1. Description

One Drive: Upload File Step uploads a file on OneDrive.


  1. Configurations 

Configuration:

No.

Field Name

Description

1

Step Name

Name of the step.  This name has to be unique in a single workflow.


Connection:


2

Checkbox: Accept value as variable/static

Leave checkbox unchecked to accept Refresh Token value from a field in the previous steps of the stream using a drop down list. 

Else enable checkbox for Refresh Token field to appear as Text box.

3

Refresh Token

Generate and specify Refresh Token as detailed in Appendix 17: OneDrive Refresh Token.

The data type is String. This field is mandatory.


If checkbox above is enabled Password field appears as Text box (enter static value or environment variable). Else if checkbox above is disabled Password field appears as a drop down to select fields from previous steps.

4

Button: Test Connection

Verifies whether the connection is established or not.


Input Tab:

No.

Field Name

Description


Input Fields:


1

File To Upload

Provide file path to upload.

The data type is String. This field is mandatory.

2

Browse

Click button to open the dialog to select the file path to upload.

3

OneDrive Folder Path

Specify the name of OneDrive folder path where the file is to be uploaded.

The data type is String. This field is mandatory.


To Upload File to root specify  Documents/

Else to upload File to any other path - Get OneDrive Path/ID as described in sections -

  1. Refer Appendix 18: OneDrive Folder/File - Path: Get Folder Path Get Folder Path
  2. Refer Appendix 18: OneDrive Folder/File - Path: Get File Path
  3. (You can use the ‘Upload File’ step to get Folder/File ID as an output of step execution).


e.g. If OneDrive path of the folder where file is to be uploaded is - https://organization-my.sharepoint.com/personal/xyz/Documents/demofolder

Then provide, 

  1. Documents/demofolder or
  2. demofolder

e.g. If file is to be uploaded on a new folder(abc) that is to be created on OneDrive, and the path of the new folder abc is,

If OneDrive path == https://organization-my.sharepoint.com/personal/xyz/Documents/abc


If abc folder is to be created then provide,

  1. Document/abc
  2. abc

4

Create Folder(if not exists)

Specify from allowed values: Yes/No.

The data type is String. 

5

File Name After Upload (Rename)

Specify the new name if file is to be renamed after upload.

The data type is String.

6

If File Exists On OneDrive Path

Specify from allowed values: 

  1. AutoRename, 
  2. Overwrite
  3. ThrowException.

The data type is String.


Output Tab:

No.

Field Name

Description


Output Fields:


1

Uploaded File ID 

Specify a fieldname to hold the output - uploaded file id

Default is UploadedFileID. The data type is String.





      Links to better reach 

            Bot Store

             EPD