How can I associate my query to few SPO sites using Ms Graph?

Olivia-2575 21 Reputation points
2022-08-22T08:42:52.587+00:00

Hi Support,

I wish to use a way to limit my search to some specific sites.
Any help would be apprecicated!

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,582 questions
0 comments No comments
{count} votes

Accepted answer
  1. HarmeetSingh7172 4,811 Reputation points
    2022-08-22T09:09:19.283+00:00

    Hi @Olivia-2575

    Hope you are doing well.

    You can use filters in your search query. Please follow this documentation to know more.

    Here's the sample request-

     POST /search/query  
          
      {  
          "requests": [  
              {  
                  "entityTypes": [  
                      "driveItem"  
                  ],  
                  "query": {  
                      "queryString": "sample AND (Path:https://xyz.sharepoint.com/sites/sitename1 OR Path:https://xyz.sharepoint.com/sites/sitename2)"  
                  }  
              }  
          ]  
      }  
    

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    0 comments No comments

0 additional answers

Sort by: Most helpful