diff --git a/source/MailKitSimplified.Receiver/Abstractions/IMailReader.cs b/source/MailKitSimplified.Receiver/Abstractions/IMailReader.cs index 256346e..4bf0f90 100644 --- a/source/MailKitSimplified.Receiver/Abstractions/IMailReader.cs +++ b/source/MailKitSimplified.Receiver/Abstractions/IMailReader.cs @@ -53,7 +53,7 @@ public interface IMailReader IMailReader Query(SearchQuery searchQuery); /// - /// Set a which message summary parts to fetch. + /// Set which message summary parts to fetch. UniqueId is always included. /// /// Message summary item filter. /// Fluent . diff --git a/source/MailKitSimplified.Receiver/Services/MailFolderReader.cs b/source/MailKitSimplified.Receiver/Services/MailFolderReader.cs index fd095ae..5342a4c 100644 --- a/source/MailKitSimplified.Receiver/Services/MailFolderReader.cs +++ b/source/MailKitSimplified.Receiver/Services/MailFolderReader.cs @@ -143,7 +143,7 @@ public IMailReader Query(SearchQuery searchQuery) public IMailReader Items(MessageSummaryItems messageSummaryItems) { - _messageSummaryItems = messageSummaryItems; + _messageSummaryItems = messageSummaryItems | MessageSummaryItems.UniqueId; return this; } @@ -217,7 +217,6 @@ private async Task> GetMessageSummariesAsync(IMailFolder return Array.Empty(); } IList filteredSummaries; - filter |= MessageSummaryItems.UniqueId; if (_uniqueIds != null) { filteredSummaries = await mailFolder.FetchAsync(_uniqueIds, filter, cancellationToken).ConfigureAwait(false); @@ -269,6 +268,7 @@ public async Task> GetMessageSummariesAsync(MessageSummar _logger.LogInformation("Take(0) means no results will be returned."); return Array.Empty(); } + filter |= MessageSummaryItems.UniqueId; (var mailFolder, var closeWhenFinished) = await OpenMailFolderAsync(cancellationToken).ConfigureAwait(false); var messageSummaries = await GetMessageSummariesAsync(mailFolder, filter, cancellationToken).ConfigureAwait(false); await CloseMailFolderAsync(mailFolder, closeWhenFinished, messageSummaries.Count).ConfigureAwait(false);