Power automate – Delete sharepoint files automatically

I have been playing with Power automate lately and I found it very useful.

I thought about one use case and many others came in mind after this one I confess…

In D365 F&SCM, you can export data into Excel and set up a document type to store the file in a sharepoint folder.

Organization administration > Document management > Document types

However, the company does not want that folder to become a trash. That’s why, any files older than 7 days could be deleted automatically. Power automate can help us achieve that.

First, set up a recurrence to run the flow automatically

Second, add a element to get all files that are stored in a specific folder

Third, add the following condition :

formatDateTime(item()[‘Created’],’yyyy-MM-dd’) is less than addDays(utcNow(),-7,’yyyy-MM-dd’)

Finally, if the condition is true, add the element to delete the files

More to come !! Stay tuned

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: