Reputation: 53
The title sums it up. I need to get all the MessageId properties from an Imap folder without downloading the entire message.
...
IMailFolder inbox = imapClient.Inbox;
SearchQuery query = SearchQuery.All;
IList<UniqueId> idsList = inbox.Search(query);
foreach (var uid in idsList)
{
MimeMessage message = inbox.GetMessage(uid);//This gets the entire message
//but I only need the .MessageId, without getting the other parts
if (message != null)
{
string messageId = message.MessageId;
}
}
...
Upvotes: 5
Views: 4457
Reputation: 38528
Try this instead:
var summaries = client.Inbox.Fetch (0, -1, MessageSummaryItems.Envelope);
foreach (var message in summaries) {
Console.WriteLine (message.Envelope.MessageId);
}
That should get you what you want.
Upvotes: 8