-
Notifications
You must be signed in to change notification settings - Fork 263
Closed as not planned
Description
I'm using Graph client to search SharePoint Sites, and functionality worked good until a few days ago, when same query begun to run indefinitely.
It keeps "finding" same sites, and "MoreResultsAvailable" flag in response is always True. (And I'm relying on that flag to quit the loop).
I'll post code snippet below that worked perfectly before but couple days ago stopped working without any changes from my side.
var siteResults = new List<Site>();
var searching = true;
int from = 0;
while (searching)
{
// Create the search request object
var searchRequest = new SearchRequest
{
EntityTypes = new List<EntityType?> { EntityType.Site },
Query = new SearchQuery
{
QueryString = "description:\"{my description}""
},
SortProperties = new List<SortProperty>
{
new SortProperty { Name = "CreatedDateTime", IsDescending = true }
},
From = from,
Size = 500,
};
// Create the QueryPostRequestBody and pass the search request inside it
var queryPostRequestBody = new QueryPostRequestBody
{
Requests = new List<SearchRequest> { searchRequest }
};
// Use the `Query` property and pass the correct request body
var searchResults = await Client.Search
.Query
.PostAsQueryPostResponseAsync(queryPostRequestBody);
// Process the search results
var siteHits = searchResults.Value.First().HitsContainers.First();
var sites = siteHits.Hits
.Select(hit => hit.Resource as Site)
.Where(site => site.Description == {"my description"}); // Exact match filter
siteResults.AddRange(sites);
// Check if more results are available
if (!siteHits.MoreResultsAvailable ?? false)
{
searching = false;
}
from += 500;
}
return siteResults;
SDK versions 5.61.0 and 5.74.0
Metadata
Metadata
Assignees
Labels
No labels