cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Collector
Kudo Collector

Flow - SharePoint Shared Docuiment Library - Deleting files

I am building a flow that must delete files from a SharePoint Shared Document Library which either are older than 30 days or match the filename of in the format "eBayITLabel_6507-00005_20190117_15_58.pdf"

The part of the filename that we would match would be 6507-00005 and that would be unique (the last 5 digits "00005" would increment one by one up to 99999...

 

Essentially we have that number in a sharepoint list, and every week we would run the flow, filter for the records in the list where status = certain values, and loop through those items, deleting all the files found that match the current string

 

so how do I search for files in the SharePoint Library using wildcards in the name like that?

 

I don't have any issues removing files older than 30 days, but would prefer to actually remove the files based on the name

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Flow - SharePoint Shared Docuiment Library - Deleting files

Hi @livingstonep,

 

For example, configure Identifier of the filtered files in Delete file action.

Image reference:

39.PNG

 

Best Regards,

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

6 REPLIES 6
Highlighted
Community Support
Community Support

Re: Flow - SharePoint Shared Docuiment Library - Deleting files

Hi @livingstonep,

 

Currently, MS Flow does not support the use of wildcards and regular expressions.

Could you share more details about your Flow configuration?

Since you mentioned that these numbers are stored in the list, you could traverse the list with "Get items-Apply to each".

Then check if the file name contains the number contained in the current item.

If yes, delete the file.

Please take a try to configure your flow.

And if it doesn't work for you, please provide more details about your needs, we would provide proper workaround for you.

 

Best Regards,

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.
Highlighted
Kudo Collector
Kudo Collector

Re: Flow - SharePoint Shared Docuiment Library - Deleting files

Hi,

 

Thanks for your help.

But the Delete method in SharePoint requires a File Identifier - how can we get that please?

Community Support
Community Support

Re: Flow - SharePoint Shared Docuiment Library - Deleting files

Hi @livingstonep,

 

Could you share a screenshot of your current Flow configuration?

I speculate that your Flow may contain Get files(properties only) action.

You could configure the Identifier it outputs in File Identifier field.

 

Best Regards,

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.
Highlighted
Kudo Collector
Kudo Collector

Re: Flow - SharePoint Shared Docuiment Library - Deleting files

Hi,

 

yes we are using Get files(properties only) action

 

so how do we get the File Identifier that we need to plug into the SharePoint - Delete file action?

 

We want to delete these files from a SharePoint Shared Document Library

Highlighted
Community Support
Community Support

Re: Flow - SharePoint Shared Docuiment Library - Deleting files

Hi @livingstonep,

 

For example, configure Identifier of the filtered files in Delete file action.

Image reference:

39.PNG

 

Best Regards,

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

Highlighted
Helper I
Helper I

Re: Flow - SharePoint Shared Docuiment Library - Deleting files

Hello,

I am attempting to create this flow that allows me to delete all files sitting in a sharepoint folder after X number of days.

However it failed.

Would you be able to advice what went wrong?

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression 'v@{body('Get_files_(properties_only)')?['value']}' is of type 'String'. The result must be a valid array.
Capture.JPG

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,729)