i have a question about gmail gdata api and his implementation on c#. I want to have the emails from a user gmail account (with his previous authorization via oauth) but i dont know how to do it. I have this code:
AccessToken = GetGoogleToken();
GOAuthRequestFactory requestFactory = new GOAuthRequestFactory("cp", TokenManager.ConsumerKey); //ConsumerKey actually is the name of web application
requestFactory.ConsumerKey = TokenManager.ConsumerKey;
requestFactory.ConsumerSecret = TokenManager.ConsumerSecret;
requestFactory.Token = AccessToken;
requestFactory.TokenSecret = GetGoogleTokenSecret();
requestFactory.UseSSL = true;
Service service = new Service(requestFactory.ApplicationName);
service.RequestFactory = requestFactory;
FeedQuery query = new FeedQuery("https://mail.google.com/mail/feed/atom/work/");
AtomFeed mails = service.Query(query);
string feeds = "";
foreach (AtomEntry item in mails.Entries) {
feeds += "\n" + item.Title.Text;
}
This doesnt work for me.. the entries are always empty. What i am missing? I hope you can help me! Thanks!!
I have been reading through the documentation since I too am in need of this functionality. As it seems, using the Atom feed will only return new emails. I assume this means unread emails.
http://code.google.com/apis/gmail/docs/inbox_feed.html
It looks like you may want to look at the SMTP and IMAP methods as a solution to get the list.