0

From this documentation I just use select and expand fields https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/listitem_get

Like this:

GET /sites/{site-id}/lists/{list-id}/items/{item-id}?expand=fields(select=Column1,Column2)

But How Can I write the seach query for fields? I want to get the list items I requested, like this:

GET /sites?search={query}

My request:

https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{list-id}/items?expand=fields(select=id, title)

But what should I do to search items by title?

0

You have various options for this.

For your example you would need to know the URL of the list item. If you have that you can use it as part of the query and retrieve the item itself.

The best way to explore whats available to you is to use the search query tool. have a look here and try it out:

https://github.com/SharePoint/PnP-Tools/tree/master/Solutions/SharePoint.Search.QueryTool

You will be able to see all data in the index for the returned results and you can use it to filter in your own query. Be aware that not all list data is in the index as queryable property. You might have to do some additional work to ensure that "Column1" and "Column2" are actually retrievable (Managed properties)

I use a specific item query sometimes to determine the index freshness, but besides that I don't know why you would search if you know which item you want. Search is a VERY EXPENSIVE API which will only be able to handle a fraction of the amount of calls a simple REST query would be able to supply.

0

you can use the managed property which is mapped to the column

_api/search/query?querytext='ListID:{id}'&'{managedproperty}:{searchedvalue}'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.