I am using Mailkit, and want to get all messages whose UniqueId is greater than a specified value.
According to the accepted answer here, "If the last UID that your client program has seen in a previous session was 123456, you'll actually want your search to start with UID 123457", and so I should use code like this...
var range = new UniqueIdRange (new UniqueId ((uint) 123457), UniqueId.MaxValue);
Well, I'm doing exactly that, but the list of IDs that comes back when I do this...
var uids = inbox.Search(range, SearchQuery.All).ToList();
includes the ID of the last message in the folder, even if this is less than 123457. In other words, the search includes 123456.
It seems that this only happens if there aren't any new messages since 123456. If there are, then 123456 won't be included in the returned ID list.
Am I doing something wrong here? The code I copied was posted by the package author himself, so I guess it should be correct. Why then am I getting an ID I already have? If there aren't any messages with ID greater than 123456, I would have expected Search
to return an empty list.
Thanks