Overview

Sections

How to create an RPA flow using OneDrive activities to download files

Beginner | 20 Minutes

RPA

Overview

This tutorial will guide you through the process of creating a basic flow using some of the OneDrive Activities. We will create a flow to download documents/files from a OneDrive folder and move them to a different folder.


📋 Requirements

Before you begin building the flow, ensure the following:

Note: All the above steps are part of the RPA User Guide.

  • Create a folder on your local disk called e.g. Attachments with the following path: C:\RPA\Attachments.
  • Create two OneDrive folders:
  • Demo_RPA_OneDrive_Move
  • Demo_RPA_Onedrive_Write
  • Add a few files to the Demo_RPA_OneDrive_Write folder that will be downloaded.

Tutorial

1

Open RPA Studio

Open RPA Studio on your machine. If you're not signed in already, you will be prompted to sign in before proceeding to the RPA flow designer screens.

2

Create a new project

On the Home page of RPA Studio, click Create New Project and specify the following properties in the popup window:

  • Name: OneDrive Download Move
  • Project Location: <default>
  • Description: OneDrive flow to download the files from the OneDrive Folder and move them to a different one.
  • Language: VB (selected by default)

3

Get files with Find Files activity

We will start by getting the files from the OneDrive folder to be downloaded. To do this, look for the Find Files or Folders activity, part of the OneDrive category, and drag it onto the design canvas. Then, set up its properties:

  • Note: To use these activities and OneDrive activities, you need to create the Oauth provider MS Office 365 as listed in the prerequisites.
  • For the Subfolder property, which should contain the folder name from where we will read the files, create an Argument:
  • Name: ReadFolder
  • Type: string
  • Default Value: "Demo_RPA_Onedrive_Write"
  • Note: If left empty, the bot will read files from the Root Folder. If you want to read files from a nested folder, specify the path as "Folder/SubFolder/…"
  • For the Item property, create a variable instead of the argument. This will store the first item ID found in the read folder:
  • Name: Item1
  • Type: OneDriveItem
  • For the Results property, create a variable instead of the argument. This will store the list of item IDs found in the folder:
  • Name: Itemlist
  • Type: OneDriveItem[] (Array of OneDriveItem)

To find the OneDriveItem[] data type, expand the Variable Type and select Array of [T]. In the pop-up, expand the dropdown under T value, click Browse for Type, and in the Type Name field, type OneDrive and select OneDriveItem under the Infor.Activities.OneDrive.Mode domain. Click OK.

4

Configure Find Files activity

Next, we'll configure the folder where the files should be moved. Use the same Find Files or Folders activity, but configure it differently:

  • For the Query property, create an argument:
  • Name: MoveFolder
  • Type: string
  • Default Value: "Demo_RPA_OneDrive_Move"
  • For the Subfolder property, leave it empty since we are looking for the folder inside the root folder of OneDrive.
  • For the Item property, create a variable to store the first item ID found in the folder:
  • Name: Move1
  • Type: OneDriveItem
  • For the Results property, create a variable to store the list of items:
  • Name: Movelist
  • Type: OneDriveItem[] (Array of OneDriveItem)

Again, expand the Variable Type and select Array of [T], and in the pop-up, select OneDriveItem.

5

Process files with ‘For Each’

Next, we will create a loop to process each file, download it, and move it to a different OneDrive folder. For this, add a For Each activity and specify the following:

  • For the Type property, set it to OneDriveItem (which is the type of a single object from the Itemlist variable).
  • For the Value property, define it as Itemlist.

Inside the For Each block, you will see the text: “For each item in Itemlist,” where "item" represents a single object within the list (in this case, a file path).

6

Add Sequence into For Each

Inside the For Each block, add a Sequence activity. This will allow you to perform multiple actions within the loop. Inside the Sequence block, add the Download File activity to download the OneDrive folder and save the files in the local system directory. Set the following properties:

  • For Download Location, create an argument:
  • Name: DownloadFolder
  • Type: string
  • Default Value: "C:\RPA\Attachments"
  • For File To Download, specify the item (the one defined in the For Each block).

7

Add Move File activity

As the last step, add the Move File or Folder activity to move the downloaded file to a different OneDrive folder. Specify the following properties:

  • For File or Folder to Move, use the item variable (same as in the For Each activity).
  • For Destination Folder, use the Move1 variable (output from the Find Files or Folders activity).

Activities List

Was this section helpful?

What made this section unhelpful for you?

On this page
  • How to create an RPA flow using OneDrive activities to download files
View as Markdown

Ask an AI

Open in ChatGPTOpen in Claude