SharePoint Online - Copy or move a file
Use the SharePoint Online - Copy or move a file action A tool for building the processes, logic, and direction within workflows. Actions are the steps the workflow performs to complete a process. to copy or move a file from one document library to another when you specify the source file and destination location. You can also copy or move files into a different site collection in the same SharePoint tenant.
- The selection made for the Delete source file when complete option in the action configuration determines if the file is copied or moved to the destination. Select, Yes to move the file and No, to copy the file. For more information, see Delete source file when complete.
- Renaming the copied or moved file is only supported when you choose to attach the file to an existing item in a list by selecting the Attach file to item option in the Specify destination by configuration field. For a detailed description of the configuration fields, see SharePoint Online - Copy or move a file action fields and settings.
For more information about the SharePoint Online connector, go to SharePoint Online.
Configure the SharePoint Online - Copy or move a file action
Important: Before inserting variables in the action configuration, you must manually type or select the values and populate other dependent fields in order to retrieve the output data. Once configured, you can insert variables to the required fields.
-
Open the action configuration panel. For more information, see Add an action to the workflow.
-
Select a Connection. If you do not have a connection, see Add a connection.
Note:Only the connections created with the List and libraries authentication method will be available in the Connection drop-down.
For more information about authentication methods for SharePoint Online connections, see Authentication methods for SharePoint Online connections.
- Select an option in Specify source by to define how you want to select the source file. The configuration fields that display in the Source file section depend on the option selected.
- Depending on the option selected in Step 3 do one of the following to specify the source file:
- Type the SharePoint site URL that has the document library with the file you want to copy or move and click Retrieve libraries.
- Select the Document library that has the file you want to copy or move.
- Specify the File path of the file you want to copy or move.
- Type the SharePoint site URL that has the document library with the file you want to copy or move and click Retrieve libraries.
- Select the Document library that has the file you want to copy or move.
- Specify the Item ID of the file you want to copy of move. For more information about how to find the Item ID, see Item ID.
- In File URL specify the URL of the file you want to copy or move.
Example: https://domain.sharepoint.com/sites/hr
All the document libraries in the specified site displays in a drop-down list in the Document library field to select from.
Example: https://domain.sharepoint.com/sites/hr
All the document libraries in the specified site are displayed in a drop-down list in the Document library field to select from.
Example: https://domain.sharepoint.com/sites/hr/report.pdf
- In the Destination location section, select the Specify destination by option to define how you want to select the destination to copy or move the file to. The configuration fields that display in the Destination location section depend on the option selected.
- Depending on the option selected in Step 5, do one of the following to specify the destination to copy or move the file to:
Note: Renaming the copied or moved file is only supported when you choose to attach the file to an existing item in a list by selecting the Attach file to item option.
- Type the SharePoint site URL that has the document library you want to copy or move the file to and click Retrieve libraries.
- Select the Document library to copy or move the file to.
- Specify the Folder path to copy or move the file to.
- Specify the Document library URL you want to copy or move the file to.
- Type the SharePoint site URL that has the item you want to attach the file to and click Retrieve lists.
Example: https://domain.sharepoint.com/sites/hr
All the document libraries in the specified site are displayed in a drop-down list in the Document library field to select from.
Example: https://domain.sharepoint.com/sites/hr/shared documents
Example: https://domain.sharepoint.com/sites/hr
All the lists in the specified site are displayed in a drop-down list in the List name field to select from.
SharePoint Online - Copy or move a file action fields and settings
Important: Before inserting variables in the action configuration, you must manually type or select the values and populate other dependent fields in order to retrieve the output data. Once configured, you can insert variables to the required fields.
Section | Field | Description | Variable types |
---|---|---|---|
(unlabeled) |
SharePoint Online connection to use to access the SharePoint Online site. To refresh the available connections, click . |
(n/a) | |
Source file | Specify source by |
Select one of the following options to define how you want to specify the source file: Note: The configuration fields that are displayed in the Source file section depend on the option selected for Specify source by.
|
(n/a) |
SharePoint site URL |
(Available only if Choose file or Item ID is selected in the Specify source by field). The URL of the SharePoint Online site that has the list or document library you want to use. To retrieve the lists for the SharePoint site URL, type the SharePoint site URL and click Retrieve lists. Example: https://domain.sharepoint.com/sites/hr |
Boolean, Collection, DateTime, Decimal, Integer, Text | |
Document library |
(Available only if Choose file or Item ID is selected in the Specify source by field). The name of the document library containing the file you want to copy or move. When you specify the SharePoint Online site URL, all the document libraries in the selected site will be available to select from in the Document library drop-down list. |
Boolean, Collection, DateTime, Decimal, Integer, Text |
|
File path |
(Available only if Choose file is selected in the Specify source by field). The path, including file name, for the file you want to copy. Note:
|
Boolean, Collection, DateTime, Decimal, Integer, Text |
|
Item ID |
(Available only if Item ID is selected in the Specify source by field). The ID of the list item you want to copy to another list. How do I get the list item ID from theSharePoint Online list?
|
Integer | |
File URL |
(Available only if URLis selected in the Specify source by field). The URL of the of the file you want to copy or move. Example :https://domain.sharepoint.com/sites/hr/report.pdf |
Boolean, Collection, DateTime, Decimal, Integer, Text | |
Delete source file when complete |
Select Yes or No to specify whether you want to delete the source file after completing the action. The option you select in this field determines if the file is copied or moved to the destination as described below:
|
Boolean | |
Destination location | Specify destination by |
Select one of the following options to define how you want to specify the destination location: Note: The configuration fields that are displayed in the Destination location section depend on the option you select for Specify destination by.
Important: When attaching the file to an item, the size of the file cannot exceed 250MB. If the file size of the file you have selected to copy or move is greater than 250MB and the Specify destination by option selected is Attach file to item, the action will fail. |
(n/a) |
SharePoint site URL |
(Available only if Choose locationor Attach file to item is selected in the Specify destination by field). The URL of the destination SharePoint Online site you want to copy or move the file to. To retrieve the lists for the SharePoint site URL, type the SharePoint site URL and click Retrieve lists. Example: https://domain.sharepoint.com/sites/hr |
Boolean, Collection, DateTime, Decimal, Integer, Text | |
Document library |
(Available only if Choose location is selected in the Specify destination by field). The name of the document library you want to copy or move the file to. When you specify the SharePoint Online site URL, all the document libraries in the selected site will be available to select from in the Document library drop-down list. |
Boolean, Collection, DateTime, Decimal, Integer, Text |
|
Folder path |
(Available only if Choose location is selected in the Specify destination by field). The path for the new location of the copied or moved file. Example: /documents/drafts Note:
|
Boolean, Collection, DateTime, Decimal, Integer, Text |
|
Document library URL |
(Available only if URL is selected in the Specify destination by field). The URL to the destination document library you want to copy or move the file to. Example: https://domain.sharepoint.com/sites/hr/shared documents |
Boolean, Collection, DateTime, Decimal, Integer, Text | |
List name |
(Available only if Attach file to item is selected in the Specify destination by field). The name of the list that has the item you want to attach the file to. |
Boolean, Collection, DateTime, Decimal, Integer, Text | |
Item ID |
(Available only if Attach file to item is selected in the Specify destination by field). The ID of the item you want to attach the file to. How do I get the list item ID from theSharePoint Online list?
|
Integer | |
New file name |
(Available only if Attach file to item is selected in the Specify destination by field). The name for the file that is attached to an existing item. |
Boolean, Collection, DateTime, Decimal, Integer, Text | |
Overwrite file with the same name |
Select Yes or No to specify whether you want to overwrite any existing file that has the same name in the destination.
|
Boolean |
|
Output |
Result |
Stores the result of the action in an object with the following variables:
|
Object |