Is it possible to use a search scope/result with Graph api "search/query" (query parameter: sourceid)

Olivier-Pierre Gatineau 1 Reputation point
2022-03-18T11:10:19.42+00:00

Hi,

I finally achieved to create a custom connector doing a search query (in SPO) using graph api "search/query"

Button from power apps -> launch flow to make search query -> response to Power Apps -> search results in Power Apps gallery

I created a Search result scope, and i'm using the "sourceid" parameter in the query but the scope is not applied and i have results from all sharepoint sites...

In graph explorer :

"requests": [
{
"entityTypes": [
"listItem"
],
"query": {
"queryString": "Plancha"
},
"sourceid": [
"GUID of the search result scope"
],
"fields": [
"title",
"ListItemId"
]
}
]
}

In my custom connector :
{
"entityTypes": [
"listItem"
],
"query/queryString": @{triggerBody()['SearchTerms_Value']},
"query/sourceid": @{variables('ScopeID')},
"query/fields": [
"title",
"ListItemId"
]
}

Did someone already successfully used "sourceid" parameter in a "search/query" graph request ?

I also noticed that the same query in graph explorer give me the "Title" field in the answer but Graph using flow doesn't...

Thanks in advance

OP

Community Center | Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,761 Reputation points Microsoft External Staff
    2022-03-18T13:39:32.893+00:00

    Hi @Olivier-Pierre Gatineau ,

    Graph API Search Request doesn't have support for sourceid, as a work around please make use of SharePoint Search REST API which has support for sourceid.

    GET /_api/search/query?querytext='{serach terms}'&sourceid='{source-id}'  
    

    Reference Documentations:
    SharePoint Search REST API
    Graph Search API Known Issues

    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

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.