Posts Tagged With: CopyFileAsync

Copying a Sharepoint file using Flow

For one of the applications that we’re moving from Notes to the Microsoft platform, I need to copy documents from one Sharepoint site to another. There are two instances in which this task will be called: when a document gets approved for publication and when a project needs a new set of documents.

In Notes, I had a handle on how to do this. For the approved documents, my agent would send them via email to the destination database as a mail-in database. For creating a new set of documents, I would simply copy the main database and give it a new name. Needless to say, I liked my Notes solution a lot, but technology and user requirements are constantly changing.

This is a relatively simple thing, but I am again lost in the code. As in the past. I want to share my experience, so you can learn from it as well. Here’s what my copy file task looks like in Flow:

Copy File Image

So, we start with the assumption that there is a document, thisItem, being processed here, then have to direct Flow where to find it and provide the destination for the document. The trick was making sure to get Folder Path before File name with extension. I tried without using the path, thinking that Sharepoint docs would always be in the same directory (which they aren’t, of course!)

The other good news, beyond realizing I can do something in a different environment is that there actually is some “code” to look at. It’s not all just drag-and-drop, pretty pictures.

    "inputs": {
        "host": {
            "connection": {
                "name": "@parameters('$connections')['shared_sharepointonline']['connectionId']"
        "method": "post",
        "body": {
            "sourceFileId": "@{triggerBody()?['{Path}']}@{triggerBody()?['{FilenameWithExtension}']}",
            "destinationDataset": "",
            "destinationFolderPath": "/Documents",
            "nameConflictBehavior": 1
        "path": "/datasets/@{encodeURIComponent(encodeURIComponent(''))}/copyFileAsync",
        "authentication": "@parameters('$authentication')"
    "metadata": {
        "flowSystemMetadata": {
            "swaggerOperationId": "CopyFileAsync"

It’s a small step, but one I’m happy to have accomplished and privileged to share.

Categories: Flow, Xpages | Tags: , , | Leave a comment

Create a free website or blog at

%d bloggers like this: