In this Power Automate tutorial, we will see how to search in SharePoint list in Power Automate. I will show you, how a user can enter a text, and it will display items containing that text in the SharePoint list. After this example, you will get to know how to find items in a sharepoint list using Power Automate.
Scenario
I have a SharePoint Online list called Job Posts, which contains the below columns:
- Title -Single line of text
- Description -Multiple lines of text
- Technology- Choice [Multiple options enabled]
- JobLocation-Single line of Text
- Posted By- Person
- Date Posted- Date/time
And also, I have added a few items to it and the list looks like the below:
Here, if the user enters the search text as “js“, it will look for the search text in Title, Technology, and JobLocation columns. And it will display the Title value for whatever column matches the result.
In this case, it will display the Titles as React Js Developer, Node js developer, and UI/UX developer. This is because the “js” text is there in the Title and Technology columns for all these 3 rows.
How to search in SharePoint list using Power Automate
Here we will see how to search or find an item in a SharePoint list using Power Automate.
Before we start creating the flow we need to make sure to create the list by using the above columns.
When a user starts the flow, it will ask to enter the search text. Based on the given search text value, the flow will return the corresponding list item title which holds the matching search values.
Step 1: Log in to Power Automate, then click on the +Create icon on the Navigation bar. Select Instant Cloud Flow.
Then provide the flow name, and select Manually trigger a flow. Click on Create.
Now you can see the Manually trigger a flow is added to the flow in Power Automate.
Expand the Manually triggers flow -> click on +Add an input -> under choose the type of user input, select ‘Text’. Then provide the Title as ‘Enter a text’.
Step 2: To search the SharePoint list of items, which column contains the ‘js’ string. For this, we will do the rest API calls.
So, click on the +New step button -> select the ‘Send an HTTP request to SharePoint’ action. Then provide the below information:
- Site address: Select or Provide the SharePoint site address.
- Methods: Select GET method as we are fetching the searched items.
- Uri: Provide the URI below code to get the searched items based on string ‘js’. Here I have provided two columns, similarly, you can add some other possible columns.
/_api/web/lists/getByTitle('Job Posts')/items?$filter=(substringof('@{triggerBody()['text']}', Technology)) or (substringof('@{triggerBody()['text']}', Title)) or ((substringof('@{triggerBody()['text']}', JobLocation)))
Step 3: Click on the +New step -> select Parse JSON action. Then provide the below information:
- Content: Provide the body of the above steps from dynamic content.
- Schema: To get the Schema, click on ‘Generate from sample’ and provide the output json of the above steps. Click on Done, you can see the schema.
Step 4: Just to show the title and technology we are getting, I have just created two variables i. e. technology and title.
So, click on the +New steps -> select Initialize variable action. Then provide the below information:
Name | Type |
---|---|
Job Title | Array |
Technology | Array |
Step 5: Use this variable, to append the technology and title of jobs into an array.
So, click on the +New step -> select Append to array variable action. Then provide the below information:
- Name: Select the name Technology from the dropdown
- Value: Here provide the below expression, which will also automatically apply to each action
join(items('Apply_to_each')?['Technology']?['results'], ' ')
Similarly, create Append to array variable action. Then provide the below information:
- Name: Select the name Technology from the dropdown
- Value: Select the technology -parse json from dynamic content.
Step 6: Click on +New step action, then select Compose action. Provide the below information:
Input: Select the job title variable from the dynamic content.
Then add another compose action and select the Tecnology variable as input from the dynamic content.
Step 7: To run the flow, click on Save -> click on the Test icon -> select Manually -> select the Test button.
Then enter the search text in the form field. Here I am searching the text ‘js’. Then click on Run Flow -> click on Done.
The job titles in the SharePoint list that contain ‘js’ are collected using Power Automate. As 3 items contain the ‘js’ string so, it will return the job title of all 3 items.
This is an example of how to search in a SharePoint list using Power Automate.
Conclusion
We can easily search for items in a SharePoint list using Power Automate. Here I have shown you an example of how to search a SharePoint list using Power Automate or how to find items in SharePoint list using power automate.
You may like the following Power Automate tutorials:
- Add Comments to SharePoint list items using Power Automate
- Create Content Type in SharePoint using Power Automate
- How to loop through SharePoint list items in Power Automate
- How to remove an item from an array in Power Automate?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.