Search for items in a list

captain_atharv 511 Reputation points
2022-12-06T08:03:43.34+00:00

Hi,
I have a list in format as mentioned below

267681-image.png

I would like to search for items only in mentioned list by providing a value.
For instance, if I search for PS, I'm expecting first 2 records to be returned as Team is PS in these 2 records.
Can someone please help with the API specs for this?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,229 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,677 questions
{count} votes

Accepted answer
  1. Tong Zhang_MSFT 9,251 Reputation points
    2022-12-07T05:52:35.523+00:00

    Hi @captain_atharv ,

    According to my research and testing, please try to use the following Graph API to filter items in a specific list:

    https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/?expand=fields&filter=fields/Team eq 'PS'  
    

    Note: You need to set up indexed for "Team" columns .(List Settings ->>Indexed columns)

    Hope it can help you. Thanks for your understanding.

    -------------------------------------------------------------------
    UPDATE-------------------------------------------------------------------

    Please try to use the following Graph API to search items in a specific list:

    POST https://graph.microsoft.com/v1.0/search/query    
    
    {  
        "requests": [  
            {  
                "entityTypes": [  
                    "listItem"  
                ],  
                "query": {  
                    "queryString": "PS path:\"https://XXXX.sharepoint.com/sites/zella/Lists/test5\""  
                }  
            }  
        ]  
    }  
    

    My test result:
    270463-01.png

    More information for reference: Use the Microsoft Search API to search OneDrive and SharePoint content


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.