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, a distinguished professional, boasts an impressive track record as a Microsoft MVP, having achieved this prestigious recognition for the eighth consecutive year since 2015. With an extensive career spanning over 18 years, Adnan has honed his expertise in various domains, notably excelling in SharePoint, Microsoft 365, Microsoft Teams, the .Net Platform, and Microsoft BI. Presently, he holds the esteemed position of Senior Microsoft Consultant at Olive + Goose. Notably, Adnan served as the MCT Regional Lead for the Pakistan Chapter from 2012 to 2017, showcasing his leadership and commitment to fostering growth within the tech community. His journey in the realm of SharePoint spans 14 years, during which he has undertaken diverse projects involving both intranet and internet solutions for both private and government sectors. His impact has transcended geographical boundaries, leaving a mark on projects in the United States and the Gulf region, often collaborating with Fortune 500 companies. Beyond his roles, Adnan is a dedicated educator, sharing his insights and knowledge as a trainer. He also passionately advocates for technology, frequently engaging with the community through speaking engagements in various forums. His multifaceted contributions exemplify his dedication to the tech field and his role in driving its evolution.

Leave a Reply