Get all the Flows connected to a SharePoint List/Library
There are times when it would be great to have a List of all the Flows deployed on a SharePoint List/Library. It's not pretty straight forward, but it's definitely possible.
I am creating a Flow with manual trigger here which will get you a list of all the Flows deployed on a SharePoint List with the 'when an item is created' trigger.
- Add an action "List Flows as Admin" or if you only want to get Flows created by you, you can add "List My Flows" action. Both these actions fall under "Power Automate Management" Connectors.
- ** Please note that I am using List My Flows actions which gives different output as compared to List Flows as Admins and will change the dependent parameters later in the Flow
- Add "Select" action to get only the necessary fields from the output array
- Mapping Expressions:
- Name - item()['properties']['displayName']
- InternalName - item()['properties']['connectionReferences']
- Connections - item()['properties']['name']
- Mapping Expressions:
- Add "Filter" Array action to keep the Flows which have a SharePoint Connection
- Initialize an Array Variable, we will need this in the next steps
- Add an "Apply to Each" action and pass Body from Select action as an input, add the following actions within Apply to Each
- Add "Get Flow" action, select the Environment and configure the Flow input field as follows
- add the Expression - item()['InternalName']
**We need this step to get the Definition of the flow which contains detailed information about trigger and actions used in the Flow
- Add "Append to Array Variable" action and configure it as follows
- {
- "Name": "item()['Name']",
- "Definition": Flow Definition from Dynamic Content
- }
** We need this step to populate the Array with all the Flow Definitions for further processing
- Add "Get Flow" action, select the Environment and configure the Flow input field as follows
- Add "Filter Array" action and pass the Array Variable as input and configure it as follows
- Choose a value = add expression item()['Definition']['triggers']
- Condition = contains
- Value = When_an_item_is_created
** We need this step to filter Flows with "When an Item is created" trigger
- Add another "Filter Array" action and pass the Body from the Filter Array above as input and configure it as follows
- Choose a value = add expression item()['Definition']['triggers']['When_an_item_is_created']['inputs']['parameters']['table']
- Condition = contains
- Value = GUID of the List/Library
** I am passing the GUID manually here but you can add another action to get the GUID of the List/Library by sending a rest query to SharePoint
There you go, you now have a list of all the Flows created by you and deployed on a SharePoint List/Library!
Hope this was helpful!
Comments
-
Get all the Flows connected to a SharePoint List/Library
Hello. This is a very interesting and potentially VERY useful flow. However, the filter 3 step failed for me. Not sure if the response body changed after you published this, but here is my error:
The execution of template action 'Filter_array_3' failed: The evaluation of 'query' action 'where' expression '@equals(item()['Definition']['triggers']['When_an_item_is_created']['inputs']['parameters']['dataset'], variables('GUID'))' failed: 'The template language expression 'equals(item()['Definition']['triggers']['When_an_item_is_created']['inputs']['parameters']['dataset'], variables('GUID'))' cannot be evaluated because property 'parameters' doesn't exist, available properties are 'host, method, path, authentication'. Please see https://aka.ms/logicexpressions for usage details.'.
If you can provide any clues as to what happened and how to correct this, I would greatly appreciate it.
Thanks,
Howard
-
Get all the Flows connected to a SharePoint List/Library
I know this is older but do you know of a way to go the other way? I have a list of all workflows through the CoE but I'm struggling with the logic to get all the SharePoint lists/libraries that are affected by the workflows.
-
Get all the Flows connected to a SharePoint List/Library
The operation "Get Flow" is not listed in the Choose an Operation list.
Up to that point it works great!
*This post is locked for comments