Get Gmail thread id
Gmail provides a thread ID to associate groups of messages in the same manner as in the Gmail web interface.
Retrieval of this thread ID is supported via the X-GM-THRID attribute on the FETCH command.
The thread ID is a 64-bit unsigned integer.
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 | // C# version using (Imap imap = new Imap()) { imap.ConnectSSL( "imap.gmail.com" ); imap.UseBestLogin( "pat@gmail.com" , "password" ); imap.SelectInbox(); List< long > uids = imap.GetAll(); List<messageInfo> infos = imap.GetMessageInfoByUID(uids); foreach (MessageInfo info in infos) { Console.WriteLine( "{0} - {1}" , info.Envelope.GmailThreadId, info.Envelope.Subject); } imap.Close(); } |
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 | ' VB.NET version Using imap As New Imap() imap.ConnectSSL( "imap.gmail.com" ) imap.UseBestLogin( "pat@gmail.com" , "password" ) imap.SelectInbox() Dim uids As List(Of Long ) = imap.GetAll() Dim infos As List(Of MessageInfo) = imap.GetMessageInfoByUID(uids) For Each info As MessageInfo In infos Console.WriteLine( "{0} - {1}" , _ info.Envelope.GmailThreadId, _ info.Envelope.Subject) Next imap.Close() End Using |
You can learn more about this Gmail IMAP extension here:
code.google.com/apis/gmail/imap/#x-gm-thrid
June 13th, 2015 at 13:05
[…] Get Gmail thread id […]