开发者

Google.GData.Client read email

I'm using Google's .NET Client Library to read email on my gmail account.

But things are not very clear for me.

I'm trying to retrieve Atom feeds with this code.

FeedQuery query = new FeedQuery();
Service service = new Service("mail", "app-MailChecker-1");
service.setUserCredentials(Username, Password);
query.Uri = new Uri("https://mail.google.com/mail/feed/atom");
AtomFeed feed = service.Query(query);

It gives me a simple exception: can't retrieve feed.

My priority is to accomplish this using Google's .NET Client Library but other options will be helpful as well.

Additional information: this me开发者_JAVA百科thod works for Google Calendar without a problem.


If you read Google's FAQ about the Google Data Protocol you'll see that it has no data API for GMail.

http://code.google.com/intl/nl-NL/apis/gdata/faq.html#GmailAtomFeed

To quote:

Does Gmail have a Data API?

No, but you can use Gmail's Atom feed with AuthSub or OAuth to request read-only access to a user's unread messages. The scope should be set to https://mail.google.com/mail/feed/atom/. An example query would be:

GET https://mail.google.com/mail/feed/atom/

If you're interested in managing your mail, Gmail also has IMAP/POP support.

I experimented with version 1.9.0.0 of the Google Data .NET Client Library myself. Don't see any references to GMail.

Here's one possible approach on how to retrieve the unread messages:

http://www.dotnetcurry.com/ShowArticle.aspx?ID=292

It's similar to what Christian suggested in his comment.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜