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 / Error when trying to d...
Power Automate
Answered

Error when trying to delete a pdf file from SharePoint

(1) ShareShare
ReportReport
Posted on by 76

I am trying to automate the replacement of a pdf file in a SharePoint document library. I have a flow that converts the original Word file and correctly saves it as a pdf (GSTB1.pdf). Now I have a new version I want to replace it with - and keep the name.   

JT1964_0-1689702063422.png

I did not see a way to "Replace" if the file if it already existed, so I was trying to save it first as a *.doc file, delete the existing *.pdf, then convert the *.doc to *.pdf.  This is where I am stuck.

 

JT1964_1-1689702430404.png

The first step does create the *.doc file, but the "Delete file 3" action fails. I expect it is the "identifier" that is wrong, but I don't know how to find the identifier for the existing pdf file.

JT1964_2-1689702758424.png

What am I missing? Thanks

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @JT-1964 

     

    You need to pass the identifier (Id) of the file to delete not the filename.

    image.png

    Thanks

  • CU29071243-0 Profile Picture
    76 on at

    So if I have a document library with 10 pdf files in it, how do I get the identifier for each pdf file?  If I use Get Files (properties only) I still need a way to pick which file to delete. Do I need to add a conditional statement that compares the filename to the identifier? Sorry - need more direction on this one. Thanks

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @JT-1964 

     

    Here it is

     

    image.png

     

    Above under the IF condition you can map the file name with extension to check which file you want to delete.

     

    Thanks

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @JT-1964 

     

    If you know the filename then you could use the Filter Query. See below

     

    image.png

  • CU29071243-0 Profile Picture
    76 on at

    Thanks for the input. I was able to get it to work following your directions, however, I had to add an additional step. First, I created a variable to represent the *.pdf file I wanted to delete.

    JT1964_0-1690200589798.png

    Then I searched for this *.pdf file and deleted it before then creating the new version.

    JT1964_1-1690200686844.png

    Thanks!

  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @JT-1964 

     

    Thanks for the update. If my thread was useful and your problem has solved, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard