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 / Add an attachment to a...
Power Automate
Answered

Add an attachment to a SP list item or replace attachment if file already exists in attachment column

(0) ShareShare
ReportReport
Posted on by 1

Hi everyone,

 

I just created a flow to create a word doc and convert it to pdf. Now the fact is that I want to add the pdf (created in my flow) in an attachment column from a SP list item. I know I can do this with the (add attachment) functionality in Power Automate, but when there already exists a file with the same name in that column, I get the error that the file with that name already exists in that column (which is logical). 

 

So my question is if there is any way possible to check if a file already exists in a attachment column and if it does, that the old file can be replaced by the new file.

 

Thank you in advance.

 

Kind regards,

Ilias Benabdellah

Categories:
I have the same question (0)
  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Ilias_ben95,

    Do you want to delete the existing file and replace it with the new added one?

    Could you please share a bit more about your scenario?

     

    Actually, you should check the display name firstly, if yes, delete the previous file and then add the new attachment:

    1. Get attachments from a list item
    2. Apply to each (for each attachment from the get attachments)
    3. Condition to check, if the current item (attachment) name is the same as the document we want to add
      1. If Yes: Delete the existing attachment from the Item
      2. If No: Do nothing
    4. After the apply to each ran through all attachments and compared it with the new document, we want to attach, leave the loop and add the attachment. If there already was an attachment with the same name, it is deleted by the loop, if there was no attachment before, it will just be added.

    vqiaqimsft_0-1639982059266.png

     

  • StefanvL Profile Picture
    5 on at

    Hi Qi,

    Can you explain what to put in "Id" and "File Identifier" columns of the "Delete Attachment" function?


    Kind regards,
    Stefan

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard