How can I get the URL to a Gmail conversation from a sent message?
I'm integrating Gmail with a task manager using a Chrome plugin. I'd like to get a link to the Gmail conversation a user has just added a message to and associate a relevant task. Every Gmail conversation has a URL associated with it, and it's in the address bar when the user is reading the co开发者_StackOverflownversation. If the user gets an email and then responds to it, the URL is right there in the address bar.
However, if a user composes a new message (not in response to an existing thread), the only way I know of to find the URL for the resulting conversation is to go into Sent Mail and click on the sent message.
Given all of Gmail's APIs (IMAP, gadgets, a Chrome extension poking around on the page), and given that the user has just clicked "Send" on a new message, is there a way to programmatically get the URL of the resulting conversation?
Probably not the best way of going about this, but if you can detect (via polling, etc.) when the little alert bar shows up,
and check whether it is the "email sent" message (i.e. the View message link exists inside it), then there is a DOM attribute on the link (which is really a span) called param
which contains a unique ID for the new conversation.
You can append that to https://mail.google.com/mail/#sent/
and you'll have a unique URL for that conversation.
精彩评论