cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Need help replacing a PDF in a SharePoint document library

Hello Flow Masters,

I'm having a terrible struggle with something but feel like it could be done with flow if I was a bit smarter.

Here's my scenario:

I've got a PowerApp/Flow combo right now that is working perfectly to recreate a SharePoint document library workflow. Users fill in some basic info and then attach a pdf with the new-ish attachment control in PowerApps. When they submit, a new item is created in a SharePoint list. That kicks off a flow that basically gets the pdf, makes a copy of it, and then deposits it into a SP document library. Here's a quick look at this flow:

 

flow1.png
flow2.png

The reason for the flow to create a copy into this document library is that approvers need to be able to view the pdf they're currently approving from within the app, and PowerApps/SP offer somewhat limited functionality on this front, so I had to use some clever workarounds that I learned here. I've been able to make it all work perfectly and if this was where things ended, my app would be fully functioning and deployed.

There's one major problem, however, that is bringing my development to a standstill: sometimes users need to add notes and comments to the pdf files that they're viewing and approving, and then these notes need to be viewed by everyone else in the workflow chain.

I've figured out a way to replace the document in my SharePoint list, but what I can't figure out how to do is delete the older version of the document in the document library, and so the pdf viewer is continuing to show the old one because there are two documents tied to the same ID, as you can see below:
doclibrary.PNG

I need to somehow delete the item with ID 35 that is older. This way the PDF viewer, when going searching for #35, will find the new, updated PDF.

I've tried inserting a "Delete File" or "Delete Item" into the middle somewhere of the above flow, but it never works.

I also thought about trying to come up with some sort of if/then statement looking for an ID and if it's already there, to delete it, but I can't figure out how to create that in flow.

Any thoughts?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Need help replacing a PDF in a SharePoint document library

Hi @Anonymous,

 

It seems that you want to delete the file with a value of 35 in WAMIncrementedID field, but the Delete action requires a value similar to ID.

You could configure Get files-Filter Query to filter out the eligible files and then configure the Idetifier in Delete file action.

Image reference:

76.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Community Support Team
Community Support Team

Re: Need help replacing a PDF in a SharePoint document library

Hi @Anonymous,

 

It seems that you want to delete the file with a value of 35 in WAMIncrementedID field, but the Delete action requires a value similar to ID.

You could configure Get files-Filter Query to filter out the eligible files and then configure the Idetifier in Delete file action.

Image reference:

76.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Re: Need help replacing a PDF in a SharePoint document library

Hello Barry!

Thanks so much for your reply. I saw your response at the end of my work day and I'm heading out for the long holiday weekend, but I'll give this a shot when I'm back the day after Christmas and let you know how it went.

Have a wonderful weekend. Can't thank you enough for your response.

Daniel

Anonymous
Not applicable

Re: Need help replacing a PDF in a SharePoint document library

Good morning Barry!

I'm going to take a swing at this today but I was wondering if there's a way to make the query dynamic, only filtering the WAMIncrementedID value for which there are two, and then also pulling the oldest one? Since this value will change and only matter when there are two of a certain value, I'm trying to figure this out.

@v-bacao-msft

Community Support Team
Community Support Team

Re: Need help replacing a PDF in a SharePoint document library

Hi @Anonymous,

 

Yes, you could configure Dynamic content in Filter Query, as long as the field to the left of the condition is a constant.

Like:

106.PNG

Also, I am not sure what Filter condition you mentioned. Could you provide specific examples?

Please provide more details about your needs and we would provide proper workaround for you.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,656)