2. PA_Graph_Site_List_Libraries Flow
At a high level at least, as noted above, this Flow is by far the most complex of the Flows described in this blog. The Flow contains numerous steps that manipulate that data returned from 4 “primary” steps that surface relevant information in SharePoint including Subsites, Document Libraries and Lists for any given site (or subsite for that matter) leveraging the SharePoint Graph v2 APIs.
This Flow could just as well be split into 3 more simplistic Flows. However as this blog speaks to the functionality depicted in the demo app I created for this blog, I elected to leave this Flow as-is. The reasoning behind this is because in the demo app the information related to PowerApps based upon a one schemas fits all approach regardless as whether any give run returned by the Flow could just is easierly be a Subsites, Document Libraries or List for any given site being queried.
What the data manipulation steps in this Flow are by and large to in essence transform the data returned from the Graph API steps in the Flow, in order that the same schema definition for any row returned by the Flow is identical whether that be Subsites, Document Libraries or Lists within any given site.
By example, by implementing this pattern showcased in demo app for this blog, I used a single Gallery control associated to the same collection as was return by that Flow. On the Items property on the singular control the think then further need to is Filter that collection based upon variable set when user clicks on the button to select and view either Document Libraries, Lists or Subsites within the parent site, greatly simplifying the amount of effort you like need to otherwise implement.
There are few noteworthy steps in this Flow that are pertinent to call out as they encompass the just of the information that this Flow returns.
A PowerApps trigger is used to instantiate this Flow along with a single input parameter being the relative URL of the site being queried. For example:
Get Site Information
This step in the Flow is a Send an HTTP request to SharePoint action that calls the SharePoint Graph v2 Sites API to quote:
“Retrieve properties and relationships for a site resource. A site resource represents a team site in SharePoint.“
In the Uri property of this step in the Flow, the
Tenant Name is derived from a variable initialized earlier in the Flow. The final part of the Uri is the input parameter passed to the Flow (
Ask in PowerApps).
As with the Get Site Information step in this Flow, this step in the Flow so too includes a Send an HTTP request to SharePoint action that calls the same said SharePoint Graph v2 Sites API.
The only different between this step in the Flow and the Get Site Information step in the Flow is this step retrieves the subsites for the site being queried.
Get Site Lists And Libraries
This step in the Flow is a Send an HTTP request to SharePoint action that calls the SharePoint Graph v2 Lists API action to retrieve a collection of lists and document libraries for the site being queried.
The Odata $select statement is specified in order that system Document Libraries and Lists are also included in the result set returned by the Flow. By default system Document Libraries and Lists are hidden.
Get Site Document Libraries
This step in the Flow is a Send an HTTP request to SharePoint action that calls the SharePoint Graph v2 Drives API action to retrieve some additional information pertaining to the document libraries for the site being queried, such as the total size of the contents in the document library as well as the number of files in each document library etc.
Select Return Fields
In the Select Return Fields step in the Flow, numerous metadata fields are specified to return useful information to PowerApps pertaining to all of the Document Libraries, Lists and Subsites for the site queried.