+1 vote


is it possible to add or modify categories with this component ?

I want to program an imap access to Exchange 2010, 2013 in vb.net and add, modify categories in several exchange boxes

thanks in advance,


1 Answer

0 votes
Best answer

Unfortunately I don't think Exchange categories are exposed thorough IMAP.

They are however added as a Keyword header to the message it self:

Keywords: Green category,Orange category

So they are easy to obtain (email.Headers["Keywords"]), harder to update/modify.

Following code downloads a message from INBOX, modifies it by adding Keyword
header and uploads it, deleting the original message:

using (Imap client = new Imap())
    client.UseBestLogin(_session.User, _session.Password);


    long uid = client.GetAll()[0];

    byte[] eml = client.GetMessageByUID(uid);
    MessageInfo info = client.GetMessageInfoByUID(uid);

    IMail email = new MailBuilder().CreateFromEml(eml);

    email.Headers["Keywords"] = "Green category,Orange category";

    client.UploadMessage(email, new UploadMessageInfo{
        Flags = info.Flags,
        InternalDate = info.Envelope.InternalDateString});


by (298k points)