-1

What's the optimal way to check if a particular MimeMessage was 'seen' yet. Meaning: how to check if the '\Seen' flag is set for a particular MimeMessage/UnqiueId?

I found the methods to set/change that flag, but now how to check if the flag is set yet...

1 Answers1

2

What you need to do is to use the Fetch (or FetchAsync) methods.

Fetch is how you obtain any and all information about a message.

var results = folder.Fetch (new UniqueId[] { uid }, MessageSummaryItems.Flags);
var seen = results.FirstOrDefault ()?.Flags.Value.HasFlag (MessageFlags.Seen);
jstedfast
  • 35,744
  • 5
  • 97
  • 110
  • Thanks for clarification I was hoping to have that info at hand on the MimeMessage which I already pulled from the IMAP server (to avoid the additional query) Similar fashion I was looking to pull that info right from the .MessageFlagsChanged event (again, to avoid the additional query) – Dierk Droth Dec 29 '20 at 07:14