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']
- 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 "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!