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 / Problem with Copy File...
Power Automate
Unanswered

Problem with Copy File that comes from Forms - "The system cannot find the file specified."

(0) ShareShare
ReportReport
Posted on by 6

Hi,
I hope someone can help me with my issue after spending hours searching the net for similar issues and trying dozens of ways ...
Probably it's just a simple mistake and I just don't see it. 

My current flow gets triggered by a form that includes a file (upload). The goal at the end is to copy the file to different locations and initiate other tasks and inform different people via teams about status'. 

The problem now occurs with the copy file in Sharepoint. The error I get is: "The system cannot find the file specified." 
My Forms is a Group Form - meaning it already interacts with SharePoint and not OneDrive Business. 

The link I retrieve from my form has the following structure (equals "varAttachmentFirst" in my flow below):

https://domain.sharepoint.com/sites/HQ-Administration/_layouts/15/Doc.aspx?sourcedoc=%7BBCB95711-C1FE-4751-B224-721B0B963441%7D&file=Documenttitle_MyFirst%20AndLastname.xlsx&action=default&mobileredirect=true

 

When I use the link in the browser I perfectly get to my file (it opens up) and I am also able to navigate to the file in the Sharepoint structure which is automatically created by using forms. 

But as soon as I try to use it in any way for moving, copying or accessing the file content I get the error message that the file could not be found. I tried different approaches, I tried using a delay, I tried shortening the URL to the part that follows the Site Address (/_layouts/15/Doc.aspx?sourcedoc={A2749E2D-6477-444E-973E-8E997739E862}&file=HR_Dates_Martin Behrens 13.xlsx&action=default&mobileredirect=true)

What do I miss? Why does the URL work in general but not in my automation? 
Can anyone help me with this? 

Best,

Martin 


Screenshot 2023-08-27 at 23.18.18.png
Screenshot 2023-08-27 at 23.18.25.png

Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    I think the problem is because the File to copy expects the url to point to a location

    Are you able to convert 

    https://presono.sharepoint.com/sites/HQ-Administration/_layouts/15/Doc.aspx?sourcedoc=%7BBCB95711-C1FE-4751-B224-721B0B963441%7D&file=HR_Dates_Martin%20Behrens%2014.xlsx&action=default&mobileredirect=true

    to something like this?

    /Documents/Foldername/HR_Dates_Martin%20Behrens%2014.xlsx

     

     

  • Manish Solanki Profile Picture
    15,169 Moderator on at

    To get the relative path of attachments, pls follow the below steps:

     

    We will add "Apply to each" action to get all the attachments link and collect the relative path in the compose action:

    ManishSolanki_1-1693186032454.png

    Expression used in the above screenshot:

    json(outputs('Get_response_details_2')?['body/rd47769ed20514a3285ceba40cbc92cd4'])

    replace 'outputs('Get_response_details_2')?['body/rd47769ed20514a3285ceba40cbc92cd4']' with the actual field in your flow.

     

    Next, inside Compose action, we will write an expression with replace() function to get the relative path of each attachment in SP site:

    ManishSolanki_2-1693186169607.png

    Expression used in above screenshot:

    replace(item()?['link'],'https://domain.sharepoint.com/sites/sitecollection','')

    pls replace 'https://domain.sharepoint.com/sites/sitecollection' with the actual SP site URL

     

    Finally, we will pass output of compose action to 'File to Copy' parameter to perform copy operation:

    ManishSolanki_3-1693186372280.png

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • mb90 Profile Picture
    6 on at

    Thanks for your answer! 

    The "problem is": I don't want to define a static path. I want to keep it dynamic in case the forms will be changed or the naming structure of the SP site will. Based on the URL I can not find the path (I only know it by searching for it manually and it is something like "Documents > Apps > Microsoft Forms > Formname > Question" ...) ... While the path from the forms entry is very different (and I don't know what happens in the background)...

  • mb90 Profile Picture
    6 on at

    Thanks for your reply and help! 

    I already have the handling of every entry and so on. When I use the replace function this only shortens my URL but does not solve my issue. 

    it only makes 

    https://domain.sharepoint.com/sites/HQ-Administration/_layouts/15/Doc.aspx?sourcedoc=%7BE5D6162A-D76D-4989-9B51-0AD33A7741ED%7D&file=FILENAME.xlsx&action=default&mobileredirect=true
    to
    /_layouts/15/Doc.aspx?sourcedoc=%7BE5D6162A-D76D-4989-9B51-0AD33A7741ED%7D&file=FILENAME.xlsx&action=default&mobileredirect=true


    and this still is not working (as I already tried this with manual entries yesterday).

    Any further ideas? 

  • Manish Solanki Profile Picture
    15,169 Moderator on at

    Hi @mb90 

     

    The link which I have mentioned was different and you can locate it in the previous run history of the flow. The provided solution works for dynamic file location provided you need to remove the top site collection URL which is static for all requests.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • mb90 Profile Picture
    6 on at

    Thanks again @ManishSolanki.
    Finally got back to this task and adapted the flow based on your answers. 

    But: it still does not change the output that I get.

    I still get

    _layouts/15/Doc.aspx?sourcedoc=%7BECCC9A19-FDB0-4D43-87F6-2D155CFEA0DB%7D&file=HR_Dates_Martin%20Behrens%2026.xlsx&action=default&mobileredirect=true

    instead of some /path/link/file.xlsx or similar.

    As you see in the screenshot attached, I removed my previous approach and only do what you recommended.

     

    Screenshot 2023-09-06 at 21.17.20.png

    The apply to each and compose fields include:

    json(outputs('Get_response_details')?['body/r47d0345d1c094a20ad4fed06289f9b99'])

    and

    replace(item()?['link'],'https://domain.sharepoint.com/sites/HQ-Administration/','')

    So I am still unable to copy the file as the flow throws an error when trying to copy the file as it says "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)".
    (But I still can open the full link in the browser and access the file in excel online)


    The 

    json(outputs('Get_response_details_2')?['body/rd47769ed20514a3285ceba40cbc92cd4'])

    does still not give me a useable path but the aspx-Doc link. 

    Don't know what to do or try anymore and can not find any proper solution online... 😞 

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 May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 471

#2
11manish Profile Picture

11manish 246

#3
David_MA Profile Picture

David_MA 238 Super User 2026 Season 1

Last 30 days Overall leaderboard