+1 vote

Hi

I'm using your library and I'm very satisfied - good job.
I'm using Assembly Mail, Version=3.0.18307.847, Culture=neutral, PublicKeyToken=6dc438ab78a525b3

Unfortunately I have problems with the Office365-Imap and Flagged/Unflagged.

// NOT working
imap.FlagMessageByUID(uid, new Flag("\\Flagged"));
imap.Search(Expression.HasFlag(new Flag("\\Flagged")));

// this is working
imap.FlagMessageByUID(uid, new Flag("\\Unseen"));
imap.Search(Expression.HasFlag(new Flag("\\Unseen")));

Only any other Imap-Servers the code above is working with all flags, but not on Office365-Imap. With an Office365-Imap all flags working EXCEPT Flagged/Unflagged.

Do you have an explanation about this situation?

Thank you for any hint.
Jürg

by

1 Answer

0 votes

Use Imap.MarkMessageSeenByUID and Imap.MarkMessageUnseend for setting seen/unseen flag.

Flagging:

List<Flag> flags = client.FlagMessageByUID(uid, Flag.Flagged);

Searching for flagged:

List<long> search = client.Search(Flag.Flagged);

I checked on Outlook.com and flagging and searching seem to work properly:

C: C6260006 APPEND INBOX (\SEEN) {30}
S: + Ready for additional command text.
C (32 bytes): ...
S: C6260006 OK [APPENDUID 14 4847] APPEND completed.
C: C6260008 UID STORE 4847 +FLAGS (\FLAGGED)
S: * 5 FETCH (FLAGS (\Seen \Flagged \Recent))
S: C6260008 OK STORE completed.
C: C6260009 UID SEARCH FLAGGED
S: * SEARCH 4847
S: C6260009 OK SEARCH completed.

In case of problems consider examining the logs.

by (272k points)
Thank you for your answer. I think I found my problem.

I removed the flags of the mails with Outlook-Client and they disappeared on Outlook-Client, but not on the server. Afterwards I used Thunderbird to check and the flags were still there. So I removed the flags with Thunderbird and run the code again... and guess what, it worked.

So obviously in my case, MS-Outlook does not remove the flags correctly.
Sorry to bother you with this question - I could have checked that before.
Cheers, Jürg
...