开发者

Get gmail inbox from c# with GData

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
     开发者_如何学JAVA       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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜