in Flow, SharePoint

Copy or move files from/to SharePoint using Microsoft Flow

Copying or moving files from one document library to another is one of the common scenarios in SharePoint when it comes to document management. It could be as simple as moving selected documents to, say, an archive document library.

Using flow you can easily orchestrate this and include any custom business processes you have as well.

Depending on where you are copying or moving the file, you may need to select different set of actions to accomplish the task. Lets look at them below.

Same SharePoint site

In this scenario, you have the source and destination libraries in the same SharePoint site . In this case, you can use the Copy to and Delete file actions available under SharePoint.

I use a manual trigger for a selected item, meaning, the option to run this flow is available to individual documents in the configured library, as shown below. You can very well use other automated triggers such as, when a file is created or modified.

run-manual-flow-library

Here is the complete flow:

copy-file-flow

Copy to action:

Given a source file path and destination file path for a particular SharePoint site, this action will copy the file from the source to the destination path.

copy-file-action

The paths are relative, so if it is the ‘Shared Documents’ root folder you want, then:

Shared Documents/<file name>

As you can see in the action, we get the path of the file from Get item action. If you do want to get the file metadata, you can use the Get file metadata action as well. The destination path, in my case, I am using a library Archive and its root folder.

Archive/<file name>

If you want to use a different folder, you can use:

Archive/<folder name>/<file name>

Note that the folder will be created if it doesn’t exist.

Delete file action:

Once the file is copied, we then use the Delete file action to delete the file from the source destination. To do this, we use the file identifier available from the Get item which is the source file.

delete-file-action

Different SharePoint site

If you are copying or moving the file to a different site, then you will need to use the Create file action instead of the Copy to action. Of course, in order to create the file, you will need the file content. To get the file content, you can use the Get file content action.

In the create file action, you can either pick the path using the picker or specify the relative for the folder path.

create-file-file-picker

Rest is pretty simple – give a name and then the file content from the Get file content action.

move-file-actions

One thing to note is that you might have trouble copying/moving files > 100 MB. This is a known limitation right now with these actions.

A simple fix to load high resolution profile pictures from SharePoint in PowerApps

In your PowerApp app, when you bind an Image control to a Picture property from a Person Field in SharePoint, by default it will display the low resolution small sized profile photo. If you explore the URL string that is returned by the Picture property, you will clearly see why: https://contoso.sharepoint.com/teams/ContosoRecruiting/_layouts/15/UserPhoto.aspx ?&Size=S&AccountName=demo@contoso.com It requests the […]