0 votes
by (150 points)

When my application is processing messages from a inbox and a issue arises, I flag the message ex:

SetMessageFlags(id, ImapFlagAction.Add, ImapMessageFlags.Flagged)

This flags the message (all messages are marked as read before my app processes them so I can not use the unread message flag and search) in outlook so someone can check the message. My application is also only processing non flagged messages ex:

Search(ImapSearchParameter.HasFlagsNoneOf(ImapMessageFlags.Flagged))

My problem is that from outlook when the flag is cleared ("Clear Flag" right-click option) the application still does not find the now unflagged email.

1 Answer

0 votes
by (73.6k points)
selected by
 
Best answer

The problem is in the behavior of Exchange server. IMAP flags are not fully linked with their Exchange/Outlook representation. This means:

If a user sets a flag to a message in Outlook, it is not reported using IMAP protocol. However if a client sets a flag using IMAP protcol, it is shown in Outlook as well.

Similar is clearing flags. If a user in Outlook clears the flag it is still reported as Flagged in IMAP protocol. However if a flag is removed using IMAP protocol, it is also cleared in Outlook.

This is behavior of Exchange/Outlook, not the IMAP protocol. Other servers do this differently e.g. Gmail.

If your server supports keywords, I suggest you to use it. If not, you have to use something else.

For example, if you use ImapMessageFlags.Draft in the INBOX folder, the user will not see this flag (nor change it), but you will be able to search for it using IMAP protocol.

by (150 points)
That's what I was expecting.  The flag will still work in my situation since the user can not change the message to correct the problem in the first place.  So a new or forwarded message allows for correction of the attachment issue and at the same time the new message doesn't have a set flagged IMAP flag set.
...