web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : hCy+Jr1jH73HNkCD4/zCGp
Power Automate - Building Flows
Answered

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

Like (0) ShareShare
ReportReport
Posted on 15 Dec 2021 11:42:31 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

  • StefanvL Profile Picture
    5 on 30 Mar 2023 at 07:27:14
    Re: Add an attachment to a SP list item or replace attachment if file already exists in attachment column

    Hi Qi,

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


    Kind regards,
    Stefan

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on 20 Dec 2021 at 06:35:30
    Re: Add an attachment to a SP list item or replace attachment if file already exists in attachment column

    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

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2