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

Get File Properties (Not Folders) Within Last X Months

Hello Everyone! Hoping to get some assistance. I'm trying to build a flow does accomplishes the following items:

1. Searches for a list of files where the modified date is greater than 6 months for a specific folder. I want it to search in subfolders.

2. Send an email out with the following info: Link to document, Document Name, Document Owner, and Document Path.

3. I DO NOT want to search and email Folder names only the File info inside the folders.

 

Below is what I have but I'm having a few problems. I keep trying different setup variations but can't come up with everything I need.

 

flowimage.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @ThisIsIt,

 

You could follow these steps to achieve your requirements:

 

Step 1: List folder to get all files of the destination folder.

Step 2: Use the formateDate() function to change the last modified date format into 'yyyy-MM-dd' for the following compare with utcNow.

Annotation 2020-01-06 113231.png

Step 3: Get file metadata by using path to get the file's item ID, after that, get its sharing link and file properties then send an email.

Annotation 2020-01-06 113349.png

 

Best Regards,
Community Support Team _ Lin Tu
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
Gareth1
Resolver IV
Resolver IV

Hi @ThisIsIt 

 

One way of doing this is to use the Get files (properties only), this will return everything in the Document library however then you could use the Filter Array action to filter based on the Path, Modified Date and if the item is a folder or file

 

Unfortunately the Path option doesn't seem to work in the OData filters (might have something to do with the curly brackets) so a filter array should work for you

Also if you use the startsWith option for filtering the path you should be able to pass in the top sub folder and it should bring in everything below it.

 

There are 3 parts to the filter so you will need to use the Advanced filter option

  • Path - using the startsWith will include subfolders
  • IsFolder if this is false then it is a file not a folder
  • Modified - allows you to filter by the date

This is the whole filter

@and(startsWith(item()?['{Path}'], 'Shared Documents/Test/'),
           equals(item()?['{IsFolder}'], false),
           lessOrEquals(item()?['Modified'], body('Get_future_time')))

Screen Shot 2020-01-05 at 2.14.06 pm.png

v-litu-msft
Community Support
Community Support

Hi @ThisIsIt,

 

You could follow these steps to achieve your requirements:

 

Step 1: List folder to get all files of the destination folder.

Step 2: Use the formateDate() function to change the last modified date format into 'yyyy-MM-dd' for the following compare with utcNow.

Annotation 2020-01-06 113231.png

Step 3: Get file metadata by using path to get the file's item ID, after that, get its sharing link and file properties then send an email.

Annotation 2020-01-06 113349.png

 

Best Regards,
Community Support Team _ Lin Tu
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

Thank you guys for your assistance!  I wasn't able to get Gareth1 suggestion to work, and I was able to get v-litu-msft to mostly work.  Here's what I'm missing.  When I select a folder in from List Folder, I need it to search the subfolders within the Folder selected.

 

Example:  When I select the Finance folder I need to also search for files within the subfolders under Finance.  Currently it's only searching for Files in the root of Finance.

Hi @ThisIsIt,

 

So there is some subfolder in the folder, normally, it is indeed could not get these files within these subfolders by using List folder action, but you can use the IsFolder properties to determine the files extracts from 1-level folder whether folder. If it is a folder, use the List Folder action again to get 2-level folder's files, then repeat these steps in the previous reply, for example:

Annotation 2020-01-07 172859.png

 

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

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,827)