web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Copy file from SPO Sit...
Power Automate
Unanswered

Copy file from SPO Site to another SPO Site

(0) ShareShare
ReportReport
Posted on by 25

Hi everyone,

a document is to be copied from one SharePoint site to another. Condition - The correct SharePoint page should be determined dynamically from the document name. Is that possible?

 


Example:

Documentname 2021-02-05-840521-Projectname

 


SPO-Site name: Project 840521

 


The six-digit number must always match - Example 840521

 


I hope someone can help me...

Many thanks in advance 😉

Categories:
I have the same question (0)
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @d3werker  you can use split expression, and then get the 3 element from array, see example below

     

    annajhaveri_0-1623080055363.png

     

  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @d3werker 

    Something like this will likely work for you:

    image.png

  • d3werker Profile Picture
    25 on at

    Thanks for the quick replies.

     

    Is "FileNameWithExtension" a placeholder? What does this stand for?

    Sorry - I'm still a beginner in this field. 😉

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @d3werker  FileNameWithExtension is property you will get from Dynamic content, when you are using Get File Properties action

  • d3werker Profile Picture
    25 on at

    Hello everybody,

    here is my approach to your cool ideas 😉

     

    pa1.pngpa2.PNGpa3.png

     

    split(outputs('Get_file_properties')?['body/{FileNameWithExtension}'],'-')[3]

     

    concat('https://name.sharepoint.com/sites/Sitename/',outputs('ProjectNo '))

     

    Unfortunately, I get this error message.

    pa4.PNG

     

    What am I doing wrong?

     

    Many thanks in Advance 😉

     

     

     

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @d3werker  test the flow by selecting the file from library and then select the flow from Automate dropdown in the toolbar

  • d3werker Profile Picture
    25 on at

    Thank you for the quick info 😉

     

    I think the mistake is in the definition of the Destination site address.

     

    Example: Destination site address could be like this.

    https://test.sharepoint.com/teams/730631-Projectname 

     

    pa5.PNG

     

    Many thanks for your help. I'm learning a lot 😉

     

    Best regards

  • d3werker Profile Picture
    25 on at

    I hope you have unstood my Problem (screenshots)...  😉

     

     

    Many thanks in Advance

     

    Best regards

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @d3werker  i didnt get the error, can you please copy the Raw Outputs of flow run and provide it here.

  • d3werker Profile Picture
    25 on at

    Hello Anna,
     
    once the file… 😉 I hope this is helpful.

     

    Many thanks in Advance...


     

    Raw Inputs: For a selected file
    {
        "schema": {
            "type": "object",
            "properties": {
                "rows": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "entity": {
                                "type": "object",
                                "properties": {
                                    "ID": {
                                        "title": "ID",
                                        "type": "integer",
                                        "format": "int64"
                                    }
                                },
                                "required": [
                                    "ID"
                                ]
                            }
                        },
                        "required": [
                            "entity"
                        ]
                    }
                }
            },
            "required": [
                "rows"
            ]
        },
        "host": {
            "connection": {
                "name": "@parameters('$connections')['shared_sharepointonline']['connectionId']"
            },
            "api": {
                "runtimeUrl": "https://flow-apim-europe-001-francecentral-01.azure-apim.net/apim/sharepointonline "
            }
        },
        "operationId": "ForASelectedFileHybridTrigger",
        "parameters": {
            "dataset": "https://testsite.sharepoint.com/teams/Reports ",
            "table": "c6defccd-20ec-47b8-9320-07824c609d53"
        }
    }

    Raw Outputs: For a selected file
    {
        "headers": {
            "Connection": "Keep-Alive",
            "Accept": "application/json,text/plain,*/*",
            "Accept-Encoding": "gzip,deflate",
            "Accept-Language": "de-DE",
            "Expect": "100-continue",
            "Host": "prod-172.westeurope.logic.azure.com",
            "Referer": "https://emea.flow.microsoft.com/ ",
            "User-Agent": "Mozilla/5.0,(Windows NT 10.0; Win64; x64),AppleWebKit/537.36,(KHTML, like Gecko),Chrome/91.0.4472.77,Safari/537.36,Edg/91.0.864.41",
            "sec-ch-ua": "\" Not;A Brand\";v=\"99\",\"Microsoft Edge\";v=\"91\",\"Chromium\";v=\"91\"",
            "x-ms-client-session-id": "404f0751-052a-4096-70fd-ca790e0299ff",
            "sec-ch-ua-mobile": "?0",
            "x-ms-client-request-id": "7eff7168-9349-4156-a35c-f42f-3fd37be6",
            "origin": "https://emea.flow.microsoft.com ",
            "sec-fetch-site": "cross-site",
            "sec-fetch-mode": "cors",
            "sec-fetch-dest": "empty",
            "X-MS-APIM-Referrer": "https://europe-001.azure-apim.net/apim/logicflows/49418E0E2EB44610B989E9092C10B643-3BF5763C4B6A3FD7/triggers/manual/run?api-version=2016-11-01 ",
            "x-ms-client-region": "europe",
            "x-ms-flavor": "Production",
            "x-ms-gateway-object-id": "",
            "X-MS-APIM-Tokens": "*sanitized*",
            "X-MS-APIM-Referrer-Prefix": "https://europe-001.azure-apim.net/apim/logicflows/49418E0E2EB44610B989E9092C10B643-3BF5763C4B6A3FD7 ",
            "X-MS-APIM-Callback": "https://europe-001.consent.azure-apim.net ",
            "x-ms-user-id": "71e7bcd1-a30b-44fa-bc43-2f226e814278",
            "x-ms-user-name": "",
            "x-ms-user-name-encoded": "RHLDpGdlciBDaHJpc3RpYW4=",
            "x-ms-user-email": "",
            "x-ms-user-email-encoded": "Y2hyaXN0aWFuLmRyYWVnZXJAbHVkd2lnLWZyZXl0YWcuZGU=",
            "x-ms-user-timestamp": "2021-06-10T07:26:38.0809026Z",
            "X-Forwarded-For": "91.248.36.144",
            "Content-Length": "473",
            "Content-Type": "application/json"
        },
        "body": {
            "entity": {
                "ID": 5,
                "itemUrl": "https://testsite.sharepoint.com/teams/Reports/Berichte/Forms/AllItems.aspx?id=%2Fteams%2FReports%2FBerichte%2F2021%2D05%2D10%2D730631%Stegano%20Berlin%20Campus%2Epdf&parent=%2Fteams%2FStegano%2FBerichte ",
                "fileName": "2021-05-10-730631-Stegano Berlin Campus.pdf",
                "FileId": "5"
            }
        }
    }


    Raw Inputs: Get file properties
    Inputs
    {
        "host": {
            "connectionReferenceName": "shared_sharepointonline",
            "operationId": "GetFileItem"
        },
        "parameters": {
            "dataset": "https://testsite.sharepoint.com/teams/Reports ",
            "table": "c6defccd-20ec-47b8-9320-07824c609d53",
            "id": 5
        }
    }

    Raw Outputs: Get file properties
    Outputs
    {
        "statusCode": 200,
        "headers": {
            "Transfer-Encoding": "chunked",
            "Vary": "Origin,Accept-Encoding",
            "X-SharePointHealthScore": "0",
            "X-MS-SPConnector": "1",
            "X-SP-SERVERSTATE": "ReadOnly=0",
            "DATASERVICEVERSION": "3.0",
            "SPClientServiceRequestDuration": "115",
            "SPRequestGuid": "14778c12-73d5-45b1-9c76-df8997261dff",
            "request-id": "14778c12-73d5-45b1-9c76-df8997261dff",
            "MS-CV": "Eox3FNVzsUWcdt+JlyYd/w.0",
            "Strict-Transport-Security": "max-age=31536000",
            "X-FRAME-OPTIONS": "SAMEORIGIN",
            "Content-Security-Policy": "frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com;",
            "MicrosoftSharePointTeamServices": "16.0.0.21326",
            "X-Content-Type-Options": "nosniff",
            "X-MS-InvokeApp": "1; RequireReadOnly",
            "Timing-Allow-Origin": "*",
            "x-ms-apihub-cached-response": "false",
            "Cache-Control": "max-age=0, private",
            "Date": "Thu, 10 Jun 2021 07:26:38 GMT",
            "P3P": "CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"",
            "X-AspNet-Version": "4.0.30319",
            "X-Powered-By": "ASP.NET",
            "Content-Type": "application/json; charset=utf-8",
            "Expires": "Wed, 26 May 2021 07:26:38 GMT",
            "Last-Modified": "Thu, 10 Jun 2021 07:26:38 GMT",
            "Content-Length": "6396"
        },
        "body": {
            "@odata.etag": "\"1\"",
            "ItemInternalId": "5",
            "ID": 5,
            "Modified": "2021-05-27T09:10:12Z",
            "Editor": {
                "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                "Claims": "
                "DisplayName": "",
                "Email": "",
                "Picture": "https://testsite.sharepoint.com/teams/Reports/_layouts/15/UserPhoto.aspx?Size=L&AccountName = ",
                "Department": "IT-Abteilung",
                "JobTitle": "Leiter IT"
            },
            "Editor#Claims": "",
            "Created": "2021-05-27T09:10:12Z",
            "Author": {
                "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                "Claims": "
                "DisplayName": "",
                "Email": "",
                "Picture": "https://testsite.sharepoint.com/teams/Reports/_layouts/15/UserPhoto.aspx?Size=L&AccountName =",
                "Department": "IT-Abteilung",
                "JobTitle": "Leiter IT"
            },
            "Author#Claims": "",
            "OData__DisplayName": "",
            "{Identifier}": "Berichte%252f2021-05-10-730631-Stegano%2bBerlin%2bCampus%.pdf",
            "{IsFolder}": false,
            "{Thumbnail}": {
               

            },
            "{Link}": "https://testsite.sharepoint.com/teams/Reports/Berichte/2021-05-10-730631-Stegano%20Berlin%20Campus.pdf ",
            "{Name}": "2021-05-10-730631-Stegano Berlin Campus",
            "{FilenameWithExtension}": "2021-05-10-730631- Stegano Berlin Campus.pdf",
            "{Path}": "Berichte/",
            "{FullPath}": "Berichte/2021-05-10-730631- Stegano Berlin Campus.pdf",
            "{IsCheckedOut}": false,
            "{VersionNumber}": "1.0"
        }
    }


    Raw Outputs: Copy file

    {

        "statusCode": 400,

        "headers": {

            "Vary": "Origin",

            "X-SharePointHealthScore": "1",

            "X-MS-SPConnector": "1",

            "X-SP-SERVERSTATE": "ReadOnly=0",

            "DATASERVICEVERSION": "3.0",

            "SPClientServiceRequestDuration": "37",

            "SPRequestGuid": "c030e51c-9960-4a96-b787-f7b85ae16813",

            "request-id": "c030e51c-9960-4a96-b787-f7b85ae16813",

            "MS-CV": "HOUwwGCZlkq3h/e4WuFoEw.0",

            "Strict-Transport-Security": "max-age=31536000",

            "X-FRAME-OPTIONS": "SAMEORIGIN",

            "Content-Security-Policy": "frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com;",

            "MicrosoftSharePointTeamServices": "16.0.0.21326",

            "X-Content-Type-Options": "nosniff",

            "X-MS-InvokeApp": "1; RequireReadOnly",

            "Timing-Allow-Origin": "*",

            "x-ms-apihub-cached-response": "true",

            "Cache-Control": "max-age=0, private",

            "Date": "Thu, 10 Jun 2021 07:26:38 GMT",

            "P3P": "CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"",

            "X-AspNet-Version": "4.0.30319",

            "X-Powered-By": "ASP.NET",

            "Content-Length": "381",

            "Content-Type": "application/json",

            "Expires": "Wed, 26 May 2021 07:26:38 GMT",

            "Last-Modified": "Thu, 10 Jun 2021 07:26:38 GMT"

        },

        "body": {

            "status": 400,

            "message": "Fehler beim Überprüfen des Vorhandenseins des Quellobjekts unter \"https://testsite.sharepoint.com/teams/Reports/5\ " aufgrund des Fehlers \"The system cannot find the file specified. (Exception from HRESULT: 0x80070002)\".\r\nclientRequestId: c030e51c-9960-4a96-b787-f7b85ae16813\r\nserviceRequestId: c030e51c-9960-4a96-b787-f7b85ae16813"

        }

    }

    {
        "host": {
            "connectionReferenceName": "shared_sharepointonline",
            "operationId": "CopyFileAsync"
        },
        "parameters": {
            "dataset": "https://testsite.sharepoint.com/teams/Reports ",
            "parameters/sourceFileId": 5,
            "parameters/destinationDataset": "https://testsite.sharepoint.com/teams/730631 ",
            "parameters/destinationFolderPath": "/Freigegebene Dokumente",
            "parameters/nameConflictBehavior": 1
        }
    }

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 450

#2
Haque Profile Picture

Haque 366

#3
Valantis Profile Picture

Valantis 349

Last 30 days Overall leaderboard