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 Search API
Microsoft Graph Search API
A Microsoft API that searches for information in email messages, returns messages ranked by relevance, and renders a dedicated search experience.
164 questions
No comments
{count} votes

Accepted answer
  1. HarmeetSingh-MSFT 3,871 Reputation points Microsoft Vendor
    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 additional answers

Sort by: Most helpful