As we all know about Microsoft is the gateway to data in Microsoft 365by providing a unified programmability model for access data. One can find all Graph API related details from docs.microsoft.com/en-us/graph and also check the graph explorer for test Graph APIs.

In this blog post I will through on creating a Power Automate Flow search content from Microsoft 365 which will include content search from emails, events,  SharePoint sites, list items, document libraries and OneDrive.

Creating Power Automate Flow

Go flow.microsoft.com and create a new flow select the blank flow and select Manually Trigger a flow. Add two input fields for type of content search and search text as shown in the screenshot

Now add a new activity Invoke an HTTP request. It’s a premium connection and once you add it, it will base resource and Azure AD resource, just pass https://graph.microsoft.com as shown in below screenshot:

Hit the sign in button and it will take you to login screen for authentication. We are using Invoke an HTTP request activity because it will help to get the details of current logged in user who is running the flow.

Now update the fields:

Method: POST 
URL of the request: https://graph.microsoft.com/v1.0/search/query
Body of Request: {
    "requests": [
        {
            "entityTypes": [
                "site"
            ],
            "query": {
                "queryString": "MSTechTalk"
            }
        }
    ]
}

Add above values to HTTP request activity as show and you can replace the text values with input parameters as shown in below screenshot.

The body of request can be modified as per needs and you can get the templates from graph explorer. I have selected list as type and sent Issue as search query string and got JOSN output which can be further transferred in flow as per the requirements.

Adnan is six time Microsoft MVP (Since 2015) with over 16 years of extensive experience with major expertise on SharePoint, SharePoint based development, Microsoft 365, Microsoft Teams, .Net Platform and Microsoft BI. He is currently working Sr Microsoft Consultant at Olive + Goose. He is MCT Regional Lead for Pakistan Chapter since 2012. He is working on SharePoint for past 12 years and worked on different intranet/intranet solutions for private & govt. sector majorly in United states and Gulf region and have experience of working with multiple Fortune 500 companies. He is a trainer, technology evangelist and also speaks in community forums.

Leave a Reply