I am working on the code to retrieve Exchange email messages by batches of 100
.
SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
FindItemsResults<Item> findResults;
ItemView view = new ItemView(100);
int inboxCount = 1;
do
{
findResults = service.FindItems(WellKnownFolderName.Inbox, sf, view);
foreach (var item in findResults.Items)
{
Console.WriteLine(inboxCount + ". " + item.Subject);
inboxCount++;
}
//error below
view.Offset = findResults.NextPageOffset;
}
while (findResults.MoreAvailable);
However, I encountered an error on findResults.NextPageOffset;
, of the following:
Cannot implicitly convert type 'int?' to 'int'. An explicit conversion exists (are you missing a cast?)
Any help will be appreciated.