+2 votes

Is it possible to check whether the message was starred or not while downloading a message from Inbox

by (1.0k points)
retagged by

1 Answer

0 votes

It depends on the IMAP server. I assume you are talking about Gmail.
You can use Gmail labels or more common IMAP flags.

First take a look at Gmail labels approach. Note that labels are very similar to folders. Here's the sample of getting labels for a specific message:

List<string> labels = imap.GmailGetLabelsByUID(uid);
bool isStarred = labels.Contains(FolderFlag.XStarred.Name);

IMAP flags approach

Get most common email properties:

MessageInfo info = imap.GetMessageInfoByUID(uid);
bool isStarred2 = info.Flags.Flags.Contains(Flag.Flagged);

Get flags only (a bit faster):

List<Flag> flags = imap.GetFlagsByUID(uid);
bool isStarred3 = flags.Contains(Flag.Flagged);
by (297k points)
No what I need is I downloaded a message from Inbox which was starred, now how can I check that whether that was starred or not like we check whether the mail has attachments
Use Imap.Search method and appropriate flag (Imap.Search(Flag.Flagged))
...