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 / When copying a file in...
Power Automate
Answered

When copying a file into other library, not getting the content file correctly

(0) ShareShare
ReportReport
Posted on by 570 Season of Giving Solutions 2025
Hi!
 
So I am trying to copy files with some property columns into another library but its hard to get. The thing is I created this flow:
It creates a file getting content from a file in another library, but when running, the error says "Resource not found":
 
What can I do?
 
Captura2.JPG
Captura1.JPG
Categories:
I have the same question (0)
  • Suggested answer
    Tomac Profile Picture
    4,046 Moderator on at
    Hi again @Charlie Martharper! Hope you had a great weekend.
     
    Instead of using Get File Content and Create File, if you want the properties to be copied over you should use the Copy File action:
  • Charlie Martharper Profile Picture
    570 Season of Giving Solutions 2025 on at
    Hi @Tomac!
     
    So how does the copy file action goes? First time using it. 
    First of all, it doesn't get the link of the sharepoint on premise.
    And the file to copy gets the file content from the get file content using path.
     
    When you say properties means the Content of the attachment or the column properties of the file that I want to copy?
  • Verified answer
    Tomac Profile Picture
    4,046 Moderator on at
     
    You'll want your Copy File action to look like this:
     
     
    You won't need to use the Get File Content action, the Copy File action handles all of that on the back end. So your whole flow would look like this:
  • Charlie Martharper Profile Picture
    570 Season of Giving Solutions 2025 on at
    Hi! 
     
    I tried it but it doesn't work correctly, this is how it look my copy file:
    When i run the flow it doesn't runs correctly:
    Invalid template it says, does this mean it doesn't get the destination folder correctly or what?
  • Tomac Profile Picture
    4,046 Moderator on at
     
    This error is saying your replace() function is bad:
     
    Can you provide the full expression you're using here? The first argument in yours is coming back as NULL.
  • Charlie Martharper Profile Picture
    570 Season of Giving Solutions 2025 on at
    Hi @Tomac!
     
    The replace I am using is this: replace(item()?['Carpeta'], 'Documents compartits/''')
     
    It replaces the first "Documents compartits" in the item column list:
     
    Ambit Value + Departament are these 2 columns:
     
    So the library is Biblioteca Troncal/Biblioteca Camp de Tarragona/Ciutadania/(and then it should start in "Assegurament accés al sistema sanitari")
     
    Thanks again for your help! I thought it could be almost the same as the other.
  • Suggested answer
    Tomac Profile Picture
    4,046 Moderator on at
     
    It looks like you copy/pasted this from the other flow, yes? The item() function only works inside of a loop-structured action (Apply To Each, Select, etc) where the action steps through a series of items.
     
    In this case, instead of "item()?['Carpeta']" you'll use the trigger output Path: triggerOutputs()?['body/{Path}']
     
    think this would be triggerOutputs()?['body/{Carpeta}'] in your environment, but you'll want to verify that
  • Charlie Martharper Profile Picture
    570 Season of Giving Solutions 2025 on at
    Hi @Tomac
     
    Ok so I have this now but it returns an error too:
    replace(item(triggerOutputs()?['body/{Path}'], 'Documents compartits/'''))
     
    The error: Unable to process template language expressions in action 'Copy_file' inputs at line '0' and column '0': 'The template language function 'item' must not have any parameters.'.
    I tried the apply to each and input path of the trigger but i get this error too
    That would replace that part, and it could start from "Assegurament i accés..."
     
     
    What should I change?
  • Suggested answer
    Tomac Profile Picture
    4,046 Moderator on at
    You need to remove item() function entirely:
     
    replace(triggerOutputs()?['body/{Path}'], 'Documents compartits/', '')
    And if that doesn't work, check the localized version of the body/path dynamic content.
     
    You won't use an Apply To Each here.
  • Charlie Martharper Profile Picture
    570 Season of Giving Solutions 2025 on at
    Hi Tomac
     
    It seems the copy file it's not supported with the on premises data gateway. So I can't use this i think
    So I used Create file but I have a problem now with the create file Ambit values. It gets the term guid code, and then it doesn't runs propperly. 
    I am getting this folder path: 
     
    /Biblioteca Troncal/[{"Value":"Biblioteca Camp de Tarragona"}]/{"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference","Id":0,"Value":"Ciutadania"}/Acollida a nous professionals/Comunicació problemes i oportunitats de millora/
     
    How could I do to get them right?
    When I put ambit value or departament value, it creates an apply to each and it also not running. I guess is that but dont know how to get it right.
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 112 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 52

#3
Ellis Karim Profile Picture

Ellis Karim 51 Super User 2026 Season 1

Last 30 days Overall leaderboard