Search code examples
exchange-serverexchangewebservicesews-managed-apiexchange-server-2016

FindItems with query string returns a maximum of only 250 results EWS


I tried filtering the Inbox which has around 10k emails using a query string and only get a maximum of 250 results. I use paged search but the MoreAvailable property is false and the TotalCount property is 250 even if there are a lot more emails matching the criteria.

var results = service.FindItems(WellKnownFolderName.Inbox,"from: [email protected]", view);

However, if i use FindItems without a filter or a query string like this:

var results = service.FindItems(WellKnownFolderName.Inbox, view); 

i get a maximum of 1000 results per page, the MoreAvailable property is true and the TotalCount is accurate(around 10k). This returns all the results in a single call.

How can i get all the results of a query using query string or SearchFilter? I will use paged search due to EWS throttling.


Solution

  • Exchange limits the maximum result set of Exchange Search queries to 250 Items in REST and EWS. with OnPrem Servers this value is adjustable via the MaxHitsForFullTextIndexSearches property https://support.microsoft.com/en-us/help/3093866/the-number-of-search-results-can-t-be-more-than-250-when-you-search-em however in Exchange OnLine (Office365) you can't adjust that value and need to work under the 250 item ceiling.