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):
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
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.
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... 😞
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
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
and this still is not working (as I already tried this with manual entries yesterday).
Any further ideas?
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)...
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:
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:
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:
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.
Thanks
I think the problem is because the File to copy expects the url to point to a location
Are you able to convert
to something like this?
/Documents/Foldername/HR_Dates_Martin%20Behrens%2014.xlsx
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1