Copying files in Power Apps

Visit Our Power Apps Page

If you’re looking for more information about Power Apps and related topics, take a look there. There you will find all articles about Power Apps in one place.

or continue reading…


As in the case of adding files, also when copying, the situation is similar. Power Apps does not have ready-made mechanisms – you should use Power Automate. Power Automate allows you to use a built-in action or call the REST API.

Copy a file in a SharePoint document library

Use of standard Power Automate actions

“Get file content” and “Create file” actions

The File Identifier should be normalized to ensure the correct syntax of the URL. Therefore, the following function was used in this field:

encodeUriComponent(variables('SrcFile'))

The SrcFile variable has been declared earlier. It has the format expected by the action Get file content, so for example: /Documents_upload/Document.docx

“Copy file” action

File to copy” should be normalized to ensure correct URL syntax. Therefore, the following function was used in this field:

encodeUriComponent(variables('SrcFile'))

The SrcFile variable has been declared earlier. It has the format expected by the “Copy File” action, so for example: /Documents_upload/Document.docx

As you can see, the action “Copy file” does not allow to specify the name of the target file. You can only choose to save under a new name – determined by the system.

In this case, the name of the new file should be returned to the application

In the following, we will see how the use of one action translates into performance.

Use of SharePoint REST API

Pay special attention to the correct specification of the SrcRelativeFileUrl and DstRelativeFileUrl variables

An example call will look like this:

/_api/Web/GetFileByServerRelativePath(decodedurl='/sites/SiteName/DocLibrary/Document.docx')/copyto(strnewurl='/sites/SiteName/DocLibrary/Document_copy.docx',boverwrite=true)

soon, in the next article – comparison of the performance of the presented methods

You May Also Like