Skip to content

Commit

Permalink
UniqueId always included in Items filter
Browse files Browse the repository at this point in the history
  • Loading branch information
danzuep committed Sep 20, 2023
1 parent 4d3549b commit 70515e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface IMailReader
IMailReader Query(SearchQuery searchQuery);

/// <summary>
/// Set a which message summary parts to fetch.
/// Set which message summary parts to fetch. UniqueId is always included.
/// </summary>
/// <param name="messageSummaryItems">Message summary item filter.</param>
/// <returns>Fluent <see cref="IMailReader"/>.</returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public IMailReader Query(SearchQuery searchQuery)

public IMailReader Items(MessageSummaryItems messageSummaryItems)
{
_messageSummaryItems = messageSummaryItems;
_messageSummaryItems = messageSummaryItems | MessageSummaryItems.UniqueId;
return this;
}

Expand Down Expand Up @@ -217,7 +217,6 @@ private async Task<IList<IMessageSummary>> GetMessageSummariesAsync(IMailFolder
return Array.Empty<IMessageSummary>();
}
IList<IMessageSummary> filteredSummaries;
filter |= MessageSummaryItems.UniqueId;
if (_uniqueIds != null)
{
filteredSummaries = await mailFolder.FetchAsync(_uniqueIds, filter, cancellationToken).ConfigureAwait(false);
Expand Down Expand Up @@ -269,6 +268,7 @@ public async Task<IList<IMessageSummary>> GetMessageSummariesAsync(MessageSummar
_logger.LogInformation("Take(0) means no results will be returned.");
return Array.Empty<IMessageSummary>();
}
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);
Expand Down

0 comments on commit 70515e2

Please sign in to comment.