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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add an attachment to a...
Power Automate
Unanswered

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard