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 SharePoint list a...
Power Automate
Unanswered

Copy SharePoint list attachments to Document library -- File already exists error in Power automate

(0) ShareShare
ReportReport
Posted on by 603

Hi All,

I am developing a Power automate which copies SharePoint list attachments to document library with when an item is created/modified trigger. I am also copying the metadata associated with list to document library columns.

 

The power automate is working fine when item is created. However, when same item is being modified, Power automate fails saying the file already exists in document library. I understand we can use Delete file option in Power automate, however in my scenario, I can't delete that file in library, as I am using that metadata in my Powerapps and want to preserve those metadata. I don't want to overwrite those metadata by deleting a file and copying it again.

 

Is there anyway where I can include a check to restrict copying the file from SP list attachments array, if file already exists in library ? Any advice would be helpful. 

 

FlowScree.PNG

 

 

Categories:
  • tom_riha Profile Picture
    10,187 Most Valuable Professional on at

    Hello @Iantaylor2050 ,

    you can add 'Get files (properties only)' action to your flow before the 'Create file' that will search if a file with the name already exists in some library. It should lead to the library with the files with Filter Query to get only files that have a specific name.

    FileLeafRef eq '<newFileName, including extension>'
    
    Notes:
    FileLeafRef is internal name for file name
    <..> is placeholder, replace it with dynamic content, don't remove the apostrophes around it

    That will give you an array of files with such file name in dynamic content 'value'. If the array is empty (you'll need to compare it to empty array variable), there isn't any file with such file name, create it. If it's not empty, the file already exists, skip the 'Create file' (and you can use the 'Identifier' dynamic content provided by the 'Get files' to update its properties). image.png

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 178

Last 30 days Overall leaderboard