0 votes

Is it possible to change the "label" of a message via the limilabs imap interface in gmail?

by

1 Answer

0 votes
 
Best answer

Yes, simply use Imap.GmailLabelMessageByUID and Imap.GmailUnlabelMessageByUID methods.

Both methods use X-GM-LABELS extension to the IMAP protocol:

using (Imap imap = new Imap()) 
{
    imap.ConnectSSL("imap.gmail.com");
    imap.Login("pat@gmail.com", "password");

    imap.SelectInbox();
    long uid = imap.GetAll().Last();

    imap.GmailLabelMessageByUID(uid, "MyLabel");

    List<string> labels = imap.GmailGetLabelsByUID(uid);

    imap.Close(); 
}

When you want to use system label instead of custom one, you can use FolderFlag class e.g.: FolderFlag.XStarred.Name

by (297k points)
...