cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KnucklezZ
Regular Visitor

Delete SharePoint files after X days failure

Hi,

 

I have created a flow that looks through certain folders on SharePoint to delete files that are older than 30 days. I've repeated the steps 4 times because I have 4 folders to look through. 

 

Two of those run successful, and two show failure. This is the failure message:

KnucklezZ_0-1652274983385.png

 

It's the same "does not exist" error every time but for different files. 

 

The flow is pretty straight forward:

KnucklezZ_1-1652275195512.pngKnucklezZ_2-1652275243776.png

 

I have these repeated with just the Folder being different.  The filter query is: 

addDays(utcNow(), -30)
 
Any ideas how to fix this?
 
Thank you,
 
Mateusz
1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @KnucklezZ ,

 

Please try:

vbofengmsft_0-1652428759995.jpeg

 

Best Regards,

Bof

 

View solution in original post

9 REPLIES 9
v-bofeng-msft
Community Support
Community Support

Hi @KnucklezZ ,

 

Please try:

vbofengmsft_0-1652428759995.jpeg

 

Best Regards,

Bof

 

Hi @v-bofeng-msft ,

 

Thanks for replying.

 

Just a few questions:

 

Do I repeat this for all 4 folders, so doing it 4 times? Also, do I keep the filter query I have used in my flow?

 

Thanks,

 

Mateusz

Hi @KnucklezZ ,

 

Yes you need to ding it 4 times. Or you could try 'Delete item' instead of 'delete file'.

 

The key point is that the 'Delete file' action can not delete a folder , so you should add a filter action to filter out the folders.

 

Best Regards,

Bof

Hi @KnucklezZ ,

 

Is the problem solved? Do you need any help?

 

Best Regards,

Bof

Hey @v-bofeng-msft 

 

Should this work?

 

KnucklezZ_0-1652949169495.pngKnucklezZ_1-1652949842110.png

KnucklezZ_3-1652949924710.png

 

 

 

Hi @KnucklezZ ,

 

you need to set the filter array's condition to 'is equal to false'

 

vbofengmsft_0-1652951875797.png

 

Best Regards,

Bof

 

Hey @v-bofeng-msft 

 

I actually noticed that after I sent the post, haha, thanks.

 

I am getting an error when I do the steps for the 2nd folder (1st seems fine):

KnucklezZ_0-1652952637154.png

 

Hi @KnucklezZ ,

 

vbofengmsft_0-1652952890899.png

The argument in items() needs to correspond to the name of the current loop, if the current loop is 'Apply to each 2' then it should be items('Apply_to _each_2') or items('Apply_to _each2')

 

Best Regards,

Bof

@v-bofeng-msft 

 

Hey,

 

Thank you so much for your help. The flow is now successful. I will keep an eye on if it's actually deleting files after the 30 days in all folders. but for now I would say it's case closed. 

 

Thanks again!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,717)