cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Get files (properties only) - Limit Entries to Folder does not work consistently

I have a significantly customised Document Library, with multiple content types (mostly various derived document sets), and have a requirement to get a list of all files within a subdirectory (in order to locate a specific file somewhere in that subdirectory structure).  The library contains around 10K files in total, but any one subdirectory structure is relatively small (< 100 files each, including all subfolders).  There are around 1000 folders at the top level.

 

The updated "Get files (properties only)" action is supposed to allow me to pass one of these top level folders as the "Limit Entries to Folder" parameter, and should then give me that list of < 100 files to operate on and search for the file I'm looking for.

 

However, regardless of how I pass the "Limit Entries to Folder" parameter to this action, either by selecting the folder within Power Automate, or passing it a full path for an individual item from that folder in Flow, whenever I use this parameter with this action, it only works on the first 15-or-so top level folders (out of around 1,000).  So if I pass the folder of any of the first 14 top level folders (by selecting the folder interactively in Power Automate), it's fine, I get a result.  

 

However if I ask it to give me a list of the files within any of the other 1,000 folders, in this case it's anything beginning with "Acu" or later, I get no results returned (Other top level folders up until "Act" work correctly, however "Acu" and all others beginning after this fail).  

 

This is obviously not very useful, when I can only get a listing of only around 1% of the folders, and appears to be a pretty significant bug.  Increasing the "Top Count" makes no difference, neither does changing the "Limit Colums to View".

 

Can anybody else replicate this issue, is there anything else I can try to get this seemingly simple action working?

5 REPLIES 5
Highlighted
Super User II
Super User II

Re: Get files (properties only) - Limit Entries to Folder does not work consistently

Hello @zylantha2 

I just tried with the "Get files (properties only)" action using a document library with several content types, 100+ folders in the root, and a 3 level deep folder hierachy - no problem, can pick any folder in the root and get all files/folders in there. 

Tried it again using a document library with folders and document sets in the root, also 100+ - again the result is that it just works.

Could you show us your action expanded? Do you have permissions to all the folders? (I am the site collection owner, so can see everything).

Kind regards, John

Highlighted
Frequent Visitor

Re: Get files (properties only) - Limit Entries to Folder does not work consistently

I experimented some more, and found that the action only works when "Include Nested Items" is set to "No".

 

As soon as I set this to "Yes", which I had on in all the original attempts, it only works inconsistently.

 

Did you have the nested items set to "Yes" or "No" when you tried?

 

I suspect that it may be linked to the list view threshhold (even though it shouldn't be) - given I have almost 10K items in the library.  Are the total items in your library above 5k?

 

In the end I had to write my own routine that recursively lists each folder to build up the complete list of documents within the tree, which should be able to be fetched with a single action.

Highlighted
Super User II
Super User II

Re: Get files (properties only) - Limit Entries to Folder does not work consistently

Hello @zylantha2 

The library with document sets has 7500+ files and I used the default setting for nested items, which is Yes. I only specified the document library and the folder manually for the test, no other setting was changed/applied.

If you have a solution for your issue, even though it is a workaround, remember to mark your post as the solution 🙂 that worked for you.

Kind regards, John

Highlighted
New Member

Re: Get files (properties only) - Limit Entries to Folder does not work consistently

I uses 'Get files (properties only)' action in a workflow to get the list of files under a library folder (which has a few subfolders, each subfolder can have some files uploaded by users), with 'Limit Entries to folder' and 'Include Nested Items' enabled. It worked well until last week when the total count of the library was over 5,000. Get files started to only return subfolders, but not files in the subfolders.

 

My temp workaround is to set 'Order by' to 'Modified desc' so I can get the files recently uploaded, however really hope 'Limit Entries to folders' can make it easier to work with large libraries.

 

 

Regards,

 

J Liang

 

 

Highlighted
Frequent Visitor

Re: Get files (properties only) - Limit Entries to Folder does not work consistently

I expect that @jliang is correct, and that "Include Nested Items" is yet another thing that doesn't work once you have > 5,000 items in the library, which is a daft limitation and probably a bug.

 

My workaround took some finessing but I'm sharing it here as it's ultimately quite neat.

 

1. I have two array variables:  "Folders to Scan" and "Documents Found".  I'm actually only interested in documents, so I'm only building up an array of documents that are found.

 

2. I initialize the "Folders to Scan" array with "array(<starting folder>)"

 

3. I then use a "Do until" loop until there are no more items in "Folders to Scan".  In the loop I list the contents of the folder (non-recursively), add any new folders to the "Folders to Scan" array, add any documents found to the "Documents Found" array, and at the end I chop the first item off the "Folders to Scan" array (which we just completed).

 

This seems to be the neatest solution, even though it's not nearly as simple as the single action, it works.  If you were interested in folders then there's nothing stopping you from adding all items found to your "Documents Found" array, rather than just documents.

 

Folder Scan.png

 

Particular action expressions expanded:

1. Do while loop:  length(variables('Folders to Scan'))

2. Folder contents:  variables('Folders to Scan')[0]

3. Scan of this folder complete: skip(variables('Folders to Scan'), 1)

 

At the end, you have the Documents Found array containing the full list of objects representing the files found, that you can then do with as you will (In my case I'm looking for a particular filename, so I use an array filter as the next action, but that's separate to the task at hand.

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,860)