cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Support
Community Support

Re: Get File Properties (Not Folders) Within Last X Months

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
Highlighted
Resolver IV
Resolver IV

Re: Get File Properties (Not Folders) Within Last X Months

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

Highlighted
Community Support
Community Support

Re: Get File Properties (Not Folders) Within Last X Months

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

Highlighted
Regular Visitor

Re: Get File Properties (Not Folders) Within Last X Months

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.

Highlighted
Community Support
Community Support

Re: Get File Properties (Not Folders) Within Last X Months

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

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