{"id":1852,"date":"2011-06-12T15:02:13","date_gmt":"2011-06-12T13:02:13","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=1852"},"modified":"2014-06-04T09:15:06","modified_gmt":"2014-06-04T07:15:06","slug":"get-gmail-thread-id","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/get-gmail-thread-id","title":{"rendered":"Get Gmail thread id"},"content":{"rendered":"<p>Gmail provides a thread ID to associate groups of messages in the same manner as in the Gmail web interface.<\/p>\n<p>Retrieval of this thread ID is supported via the X-GM-THRID attribute on the FETCH command.<\/p>\n<p>The thread ID is a 64-bit unsigned integer.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\/\/ C# version\r\n\r\nusing (Imap imap = new Imap())\r\n{\r\n    imap.ConnectSSL(&quot;imap.gmail.com&quot;);\r\n    imap.UseBestLogin(&quot;pat@gmail.com&quot;, &quot;password&quot;);\r\n\r\n    imap.SelectInbox();\r\n\r\n    List&lt;long&gt; uids = imap.GetAll();\r\n    List&lt;messageInfo&gt; infos = imap.GetMessageInfoByUID(uids);\r\n\r\n    foreach (MessageInfo info in infos)\r\n    {\r\n        Console.WriteLine(&quot;{0} - {1}&quot;,\r\n            info.Envelope.GmailThreadId,\r\n            info.Envelope.Subject);\r\n    }\r\n\r\n    imap.Close();\r\n}\r\n<\/pre>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n' VB.NET version\r\n\r\nUsing imap As New Imap()\r\n\timap.ConnectSSL(&quot;imap.gmail.com&quot;)\r\n\timap.UseBestLogin(&quot;pat@gmail.com&quot;, &quot;password&quot;)\r\n\r\n\timap.SelectInbox()\r\n\r\n\tDim uids As List(Of Long) = imap.GetAll()\r\n\tDim infos As List(Of MessageInfo) = imap.GetMessageInfoByUID(uids)\r\n\r\n\tFor Each info As MessageInfo In infos\r\n\t    Console.WriteLine(&quot;{0} - {1}&quot;, _\r\n                info.Envelope.GmailThreadId, _\r\n                info.Envelope.Subject)\r\n\tNext\r\n\r\n\timap.Close()\r\nEnd Using\r\n<\/pre>\n<p>You can learn more about this Gmail IMAP extension here:<br \/>\n<a href=\"http:\/\/code.google.com\/apis\/gmail\/imap\/#x-gm-thrid\">code.google.com\/apis\/gmail\/imap\/#x-gm-thrid<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. \/\/ C# version using (Imap imap = new Imap()) { imap.ConnectSSL(&quot;imap.gmail.com&quot;); imap.UseBestLogin(&quot;pat@gmail.com&quot;, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[25,28,77,57,66],"class_list":["post-1852","post","type-post","status-publish","format-standard","hentry","category-mail-dll","tag-gmail","tag-imap","tag-imap-component","tag-vb-net","tag-x-gm-thrid"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1852"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=1852"}],"version-history":[{"count":2,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1852\/revisions"}],"predecessor-version":[{"id":4615,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/1852\/revisions\/4615"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=1852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=1852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=1852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}