PowerApps & SharePoint – The Ultimate User Experience – Dynamic Data Sources – Graph – Power Automate

1. PA_Graph_Search_Sites Flow

Step 1 – PowerApps Trigger

Create a Flow that you can instantiate from PowerApps.

  • Flow Designer -> New -> Instant--From Blank
  • Select the “PowerApps - Trigger” action to begin with.

Step 2 – Send an HTTP request to SharePoint

  • Add a New step -> Action -> Send an HTTP request to SharePoint
  • Rename step -> Get Files (or any other meaningful name as desired)
  • For Site Address enter the parent URL for your SharePoint tenant:
    https://tenant.sharepoint.com
  • For the Uri enter:
    _api/v2.0/sites/?search=
    Append Ask in PowerApps to the Uri from the Dynamic content popup window
  • Add the following key-value pair in the Headers property
    Acceptapplication/json

Step 3 – Select [Data Operations]

  • Add a New step -> Action -> Select [Data Operations]
  • Rename step -> Select Return Fields (or any other meaningful name as desired)
  • For the From property enter the following Expression:
    array(body('Get_Sites')?['value'])
  • For the Map property enter whatever values you’d like to return to PowerApps. Per the documentation on the Microsoft Graph website for the Search API (“beta”) . The possible values you can return include:
    • id – item()['id']
    • name – item()['name']
    • description – item()['description']
    • createdDateTime – item()['createdDateTime']
    • lastModifiedDateTime – item()['lastModifiedDateTime']
    • webUrl – item()['webUrl']

Save and Test the Flow

At this point, you will need to Save the Flow and then Test it from the same page on the Flow website. Specify any keyword to search for matching sites on your SharePoint tenant. For example:

Having executing the Test run of the Flow, copy the OUTPUTS Body value returned in the Select Return Fields step in the Flow. You’ll need to use this as a sample payload to generate the schema for the final Response action step in this Flow.

Step 4 – Response

  • Add a New step -> Action -> Response [Request]
  • For the Body property, select the Output value in the Dynamic content popup window from the previous Select Return Fields step in the Flow.
  • For the Response Body JSON Schema property click on Use sample payload to generate schema and paste the content from the OUTPUTS Body returned in the Test run of the Flow.

Test from PowerApps

At this point you can now consume this Flow from any app you create in PowerApps. For example to test the Flow:

  • Associate the Flow to your app (Action menu -> Flows).
  • Insert a Combo box input control to a screen in your app.
  • Add a Search icon and on the OnSelect action for that icon instantiate the Flow and specify a collection name into which the search results of the Flow will be returned.
    For example:
    ClearCollect(
    SharePointSites,
    PA_Graph_Search_Sites.Run( ComboBox1.SearchText )
    )
  • For your Combo box control enter the name of the collection you specified to return the results of the search query from the Flow.
    For example: SharePointSites

That’s it for this Flow!

You should now be able to test your app by specifying a keyword to search for in the Combo box control you added to the screen. Thereafter click the Search icon control to instantiate the Flow, following which any matching site search results should be returned in the collection your specified and equally populated and listed in the Combo box control on the screen in your app.

Up next: 2. PA_Graph_Site_List_Libraries Flow

11 thoughts on “PowerApps & SharePoint – The Ultimate User Experience – Dynamic Data Sources – Graph – Power Automate”

  1. Get Drive Items doesn’t seem to be available anymore? I couldn’t figure out an easy way to do this, other than either creating my own connector to graph API or using the HTTP request action.

    1. The link to a GitHub repository “was” at the end of the blog however I made it private because I have been considering modifying some of the flows to “possibly” make them easier to follow and equally surface more information.

      That said I’ve “temporarily” made the GitHub repository for the original flows publically viewable again, albeit that I will make it private again in a few days. Primarily because I am working on a new blog where there is a lot functionality I’ve been developing such that it will be that much easier to read the new blog, follow the technical site and leverage for use in App Makers own apps. The new blow secifically pertains to changes made to the PA_Graph_DriveItems flow in this blog.

      GitHub – Office365Master/PowerApps-SharePoint—The-Ultimate-User-Experience
      https://github.com/Office365Master/PowerApps-SharePoint—The-Ultimate-User-Experience

Comments are closed.