Search results returns empty hits

Copper Contributor

Hello,

 

I'm using microsoft graph to query document libraries on my SharePoint Online site.

I'm querying managed property.

When I tested it on Graph explorer - I got result with hits that contained the actual file that has this managed property.

When I tried to develop it - I got result that matched the graph explorer - but the hit section was empty [[{}, {}]

 

Here's the data I'm using in Graph explorer:

 

{
   "requests": [
   {
     "entityTypes": [
         "driveItem"
     ],
     "query": {
         "queryString": "RefinableString01:'555555'"
    }
  }
 ]
}
 
and here's the code I'm using:
GraphServiceClient client = GetAuthenticatedGraphClient(userName, userPassword);
var searchRequest = new
{
requests = new[]
{
new
{
entityTypes = new[] {"microsoft.graph.driveItem"},
query = new
{
query_string = new
{
query = "RefinableString01:'555555"
}
}

}
}
};
//construct a request

var message = new HttpRequestMessage(HttpMethod.Post, "https://graph.microsoft.com/v1.0/search/query");
var jsonPayload = client.HttpProvider.Serializer.SerializeObject(searchRequest);
message.Content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
await client.AuthenticationProvider.AuthenticateRequestAsync(message);
var response = await client.HttpProvider.SendAsync(message);
//process response
var content = await response.Content.ReadAsStringAsync();
var result = JObject.Parse(content);
 
 
This is the result I'm getting:
 
{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.searchResponse)","value":[{"searchTerms":[],"hitsContainers":[{"total":2,"moreResultsAvailable":false,"hits":[{}]}]}]}
 
Does anybody have any idea why this is hapenning? 
Thanks,
Barak
0 Replies