Recently a new option was released in Power Automate (formerly Microsoft Flow) which is available in the SharePoint action ‘Get Items’:
- Limit Entries to Folder
- Include Nested items
The same settings have recently been included in the action ‘Get files (properly only)’:
For some people, it would make sense to see those settings for files and not in a list as by default folders are not enabled in SharePoint lists. In this post, it’ll be shown how to enable this and the advantages of using those settings in a list.
What’s the difference between using a field to filter/group items or folders to organise them?
Using this approach it’s possible to break security in the folders level instead of creating separate lists if needed different levels of access, and then manage the settings of only one list.
So if there’s a need to break permissions, why not create a content type and reuse it across lists (instead of folders inside of a single list)?
That would work thinking from a list columns settings perspective only. The list views and other settings would still have to be managed separately.
Also, for Flows triggered when an item is modified/created, a Flow would have to be created for each list, as it’s not possible to trigger a Flow from a content type (as per March 2020). Using the folders approach only one flow is needed.
How to enable it?
Under the list settings page, navigate to the ‘Advanced Settings’ option:
Find the ‘Make “New Folder” command available?’, switch it to ‘Yes’.
Click ‘Ok’ to confirm and now back to any list view you’ll be able to see the ‘New Folder’ button:
Now you can start adding your folders, and items inside folders:
What about an example of a Flow with this approach?
Following the example above, consider people keep adding items to two of the folders and some items in the root folder of it:
South America Folder
And a daily summary is needed for all items included in Europe folder only.
That’s when the new action is handy.
Steps to build the Flow
First of all, to build the flow we start with the recurrence trigger:
Then to retrieve the items from the chosen folder, the next step is to add the SharePoint action ‘Get items’, and use the new setting to filter the desired folder.
To find the list folder under the list, when clicking the folder icon under the option ‘Limit entries to folder’, you’ll have to navigate to /Lists, then find the list by name, and select the folder:
By default, if the folder has subfolders, all results from the subfolders are going to be retrieved. In case they are not needed, the setting ‘Include Nested Items’ should be set up to false (it makes no difference in this case).
After retrieving the items from the folder, use the ‘Create HTML Table’ action to generate an output from the list of items and add columns as desired (only three in the example below for simplicity):
To wrap up the flow, send the HTML output in an email message (use code view to add it):
After your trigger is executed (or you trigger the Flow manually if preferred), the summary for Europe folder is received:
By the table retrieved, note the items retrieved are coming only from the Europe folder.
The same could be achieved using different approaches before, but it makes the solution cleaner and simpler to be built with the new setting available. And also the solutions using it can easily customisable within Power Automate.