Thanks for the confirmation Jeff.

For anyone interested, here is the quick and dirty version of my
solution to this issue.  I'm reading the ATOM Xml into a DataSet to
process it and this may not be the best way to go, you could download
Atom.NET once you retrieve the Xml from Google, but this works for my
purposes.


// Build and convert the authorization information
// The variables account and password are strings with the GMail
credentials
StringBuilder sb = new StringBuilder(account);
sb.Append(":");
sb.Append(password);
Byte[] bytes = Encoding.ASCII.GetBytes(sb.ToString());

// Create the request
WebRequest feedRequest = WebRequest.Create("https://mail.google.com/
mail/feed/atom");
// Google uses Basic Auth so we add this header to the request
feedRequest.Headers.Add("Authorization", "Basic " +
Convert.ToBase64String(bytes));
// Get the response in the form of a stream
Stream feedStream = feedRequest.GetResponse().GetResponseStream();

// We are going to use a DataSet and XmlReader to get at the contents
of the Xml Response
DataSet dsFeed = new DataSet();
XmlReader feedReader = XmlReader.Create(feedStream);
dsFeed.ReadXml(feedReader);

lblSource.Text =
dsFeed.Tables["feed"].Rows[0].ItemArray[0].ToString();

for (Int32 loopMsg = 0; loopMsg < dsFeed.Tables["entry"].Rows.Count;
loopMsg++)
{
    // Build the row for the author and date
    TableRow trAuthorDate = new TableRow();
    TableCell tdAuthor = new TableCell();
    TableCell tdDate = new TableCell();
    tdDate.HorizontalAlign = HorizontalAlign.Right;

    Label lblAuthor = new Label();
    lblAuthor.Text =
dsFeed.Tables["author"].Rows[loopMsg].ItemArray[0].ToString();
    tdAuthor.Controls.Add(lblAuthor);

    DateTime dtDate =
DateTime.Parse(dsFeed.Tables["entry"].Rows[loopMsg].ItemArray[4].ToString());
    Label lblDate = new Label();
    lblDate.Text = dtDate.ToString("g");
    tdDate.Controls.Add(lblDate);

    // Add all cells to the row
    trAuthorDate.Cells.Add(tdAuthor);
    trAuthorDate.Cells.Add(tdDate);

    // Add the row to the table
    tblMessageList.Rows.Add(trAuthorDate);


    // Build the row for the subject
    TableRow trSubject = new TableRow();
    TableCell tdSubject = new TableCell();
    tdSubject.ColumnSpan = 2;

    Label lblSubject = new Label();
    lblSubject.Text =
dsFeed.Tables["entry"].Rows[loopMsg].ItemArray[0].ToString();
    tdSubject.Controls.Add(lblSubject);
    // Add all cells to the row
    trSubject.Cells.Add(tdSubject);

    // Add the row to the table
    tblMessageList.Rows.Add(trSubject);


    // Build the row for the message
    TableRow trMessage = new TableRow();
    TableCell tdMessage = new TableCell();
    tdMessage.ColumnSpan = 2;

    Label lblMessage = new Label();
    lblMessage.Text =
dsFeed.Tables["entry"].Rows[loopMsg].ItemArray[1].ToString();
    tdMessage.Controls.Add(lblMessage);
    // Add all cells to the row
    trMessage.Cells.Add(tdMessage);

    // Add the row to the table
    tblMessageList.Rows.Add(trMessage);
}


On May 1, 12:20 pm, "Jeff Fisher (Google)" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> You are correct in that there is not currently a Data API for GMail.
> You can star this issue in our issue tracker to support it, though:
>
> http://code.google.com/p/gdata-issues/issues/detail?id=271
>
> Cheers,
> -Jeff
>
> On Apr 30, 12:45 pm, stevenjamesfrank <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Based on a search I did of this group it seems to me that it is
> > currently not possible to use GData to get at Gmail.
>
> > Can someone from Google;
> > 1) Confirm this is the case (or not)
> > 2) If not, address if/when this might become available
>
> > I realize Atom can be used and Atom/RSS applications are a dime a
> > dozen, but it seems that if opening up the calendar and contacts via
> > GData makes sense, it certainly makes sense for GMail.
>
> > Even read-only access would be very welcome, something like this:
>
> > Service gmailService = new Service("myApp");
> > gmailService.setUserCredentials(account, password);
>
> > FeedQuery gmailQuery = new FeedQuery("https://mail.google.com/mail/
> > feed/atom");
>
> > AtomFeed gmailFeed = gmailService.Query(gmailQuery);
>
> > Response.Write(gmailFeed.Entries.Count);
> > Response.Write("<br />");
> > for (Int32 loopMsg = 0; loopMsg < gmailFeed.Entries.Count; loopMsg++)
> > {
> >     Response.Write(gmailFeed.Entries[loopMsg].Title);
> >     Response.Write("<br />");
>
> > }- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to