How to programmatically retrieve the atom feed from gmail



Gmail has added Atom web feeds, a format that's similar to RSS.The feeds include a summary of each new message in your Google email.Below you can find how to programmatically retrieve the atom feed from gmail.

 

 
using System;
using System.IO;
using System.Net; 
 
WebClient client = new WebClient();
client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
client.Credentials = new NetworkCredential("loginname","password"); 
Stream data = client.OpenRead ("https://gmail.google.com/gmail/feed/atom");
StreamReader reader = new StreamReader (data);
string s = reader.ReadToEnd (); 
Console.WriteLine (s); 
data.Close ();
reader.Close ();


 
 
 

Leave a Reply