cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
noobi
Helper II
Helper II

HTTP Request to Sharepoint Site Columns

Hello everyone,

 

I want to automate a flow where i send and Http Request to a Sharepoint-Site.

 

If i request, the request runs fine and returns all records as expected. My problem is that, when I enter the search bar it returns the records from a column I do not want to use. I want to use  another column resulting from the same search basically. 

My questions is: How can I modify my HTTP Request to return the result from the people column and not the general column.

It looks like this:

 

HttpQuery.JPG

 

 

 

_api/search/query?querytext='Example Department' 

 

 

 

 

 

Any help is appreciated.

 

Best Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @noobi,

 

Does the action return any values when you remove the $filter query parameter?

 

Have you tried a different operator instead of equals (eq). Maybe it is good to test with a startswith instead:

https://graph.microsoft.com/v1.0/users/?$filter=startswith(department,'Bananas')&$select=displayName,mail,department

 

Btw, you can also test all your queries in Graph Explorer first. Logon with your account and run it in the browser.

https://developer.microsoft.com/en-us/graph/graph-explorer

 

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

14 REPLIES 14
Expiscornovus
Super User
Super User

Hi @noobi,

 

Have you tried using the 'NameofField:Example Department' approach? With in search you can specify to search within fields/(managed) properties 

 

Below would be an example which would only retrieve pdf by using the FileType field

 

_api/search/query?querytext='FileType:pdf'

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


noobi
Helper II
Helper II

Hello Expiscornovus, 

sorry I cannot understand you.

 

I type in the sharepoint search bar the name of the department and search. There appear different column headers then, of which a General one is selected by default that does not show the people listed in a gallery, but some random pdfs. People are to find in a different header called People right next to the default selected General header. The people header lists people as gallery items with name and department and pictures. If I click on the people header then I see all people from the department I searched for if I scroll down.

 

 

 

Expiscornovus
Super User
Super User

Hi @noobi,

 

If I understand you correctly you are talking about the Search scopes/filters like All, Files, Sites, People, News & Images.

 

The Search REST API you are using is not automatically applying the same kind of logic like in the interface. You have to include that kind of logic within your Uri.

 

In your case if you want to only search for people and those type of results I would use the Local People Results source in the query.

 

Try something like below

_api/search/query?querytext='Example Department'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'

 

More about the SharePoint Search REST API can be found over here:

https://learn.microsoft.com/en-us/sharepoint/dev/general-development/sharepoint-search-rest-api-over...

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hello Expiscornovus,

 

thank you for the tip. Now I know what I have to look for. Unfortunately, I do not have any idea how to extract the source id. The only attribute that differs the two search results are "&datasource=intranet" and "&datasource=people" respectively. 

 

Best Regards,

Expiscornovus
Super User
Super User

Hi @noobi,

 

Can you try the query with the same sourceid I shared? It looks like the GUID of the People data source is the same across different tenants (because it is a system generated one) 😀



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


noobi
Helper II
Helper II

Hello Expiscornovus,

thank you for the tip.

 

Unluckily the id did not work for me. Anyway, happy to have learned a lot 🙂

 

 

Expiscornovus
Super User
Super User

Hi @noobi,

 

Maybe we should take one step back 😀

 

What are you trying to achieve? Do you want to retrieve all people from a single department with their details?

 

If that is the case, maybe have a look at the Graph API list users method as well. You can also get peoples details from that endpoint. And with a $filter query parameter you can filter on a specific department.

 

Below is an example

This example uses the Send an HTTP request action of the Office 365 Groups connector. In this example I am retrieving all employees of the Finance department (and details like displayName,mail,jobTitle and their manager).

 

https://graph.microsoft.com/v1.0/users/?$filter=department eq 'Finance'&$select=displayName,mail,jobTitle&$expand=manager($select=displayName,mail,jobTitle)

 

people_graphapi.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


noobi
Helper II
Helper II

Hello Expiscornovus,

 

thank you for the Input. I tried to use your method but if I search I only have returned a blank result.

Do the Groups have to exist as an public office365 group in order for the search to work. Because if I search for parts of the department I have returned users, which are from other countries. 

 

Best Regards,

Expiscornovus
Super User
Super User

Hi @noobi,

 

Can you share a screenshot of what you have tried?

 

And can you clarify what you are looking for? You have are looking for a department keyword and you want to return a office 365 group which has that department name? If that is the case we might need a different approach. I suggested to look for certain users. In that case we might need to list groups instead.

 

Again please share what you are trying to achieve, this way I can understand a bit better and help you out 🙂



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hello Expiscornovus,

 

yes, I tried your approach.

I just want to list all users of a specific department from my office 365space. 

Screenshot 2022-12-10 122300.png

Expiscornovus
Super User
Super User

Hi @noobi,

 

In this specific Send an HTTP request action you need to escape the question mark character within the URI. As you can see in my screenshot I placed a forward slash just before the question mark character.

 

Can you try this URI instead?

 

https://graph.microsoft.com/v1.0/users/?$filter=department eq 'Bananas %26 Apples'&$select=displayName,mail

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hello Expiscornovus,

good start in the week.

Unfortunately the value field is empty if I try the URI. 

🙂 

Best Regards,

 

 

Expiscornovus
Super User
Super User

Hi @noobi,

 

Does the action return any values when you remove the $filter query parameter?

 

Have you tried a different operator instead of equals (eq). Maybe it is good to test with a startswith instead:

https://graph.microsoft.com/v1.0/users/?$filter=startswith(department,'Bananas')&$select=displayName,mail,department

 

Btw, you can also test all your queries in Graph Explorer first. Logon with your account and run it in the browser.

https://developer.microsoft.com/en-us/graph/graph-explorer

 

 

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


noobi
Helper II
Helper II

Jesus thank you dude, I forgot to have the "Consulting -" first. Your approach works perfectly. Thank you for all the patience!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,280)