refer the below link
http://www.simple-talk.com/sql/reporting-services/beginning-sql-server-2005-reporting-services-part-2/
gmail contact in .net web application using Google Contacts API

Source Code
using Google.GData.Client;
using Google.GData.Contacts;
using Google.GData.Extensions;
public partial class _Default : System.Web.UI.Page
{
private Service service;
private string uname;
private string authToken;
private String googleAuthToken = null;
private ContactsService contactsService = null;
public void Page_Load(object sender, EventArgs e)
{
this.contactsService = new ContactsService("GoogleContactsSample");
}
public void vyaslogin(Service servicetouse,string username)
{
this.service = servicetouse;
this.uname = username;
}
protected void Button1_Click(object sender, EventArgs e)
{
vyaslogin(this.contactsService, "pyk.vyas@gmail.com");
this.service.setUserCredentials(gmailusername.Text, gmailpassword.Text);
try
{
this.authToken = this.service.QueryAuthenticationToken();
Label1.Text = "login success";
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri(gmailusername.Text));
this.lbcontacts.Items.Clear();
ContactsFeed feed = this.contactsService.Query(query);
if (feed != null && feed.Entries.Count > 0)
{
foreach (ContactEntry entry in feed.Entries)
{
this.lbcontacts.Items.Add(entry.PrimaryEmail.Address.ToString());
}
}
}
catch
{
Label1.Text="login failed";
}
}
}
using Google.GData.Contacts;
using Google.GData.Extensions;
public partial class _Default : System.Web.UI.Page
{
private Service service;
private string uname;
private string authToken;
private String googleAuthToken = null;
private ContactsService contactsService = null;
public void Page_Load(object sender, EventArgs e)
{
this.contactsService = new ContactsService("GoogleContactsSample");
}
public void vyaslogin(Service servicetouse,string username)
{
this.service = servicetouse;
this.uname = username;
}
protected void Button1_Click(object sender, EventArgs e)
{
vyaslogin(this.contactsService, "pyk.vyas@gmail.com");
this.service.setUserCredentials(gmailusername.Text, gmailpassword.Text);
try
{
this.authToken = this.service.QueryAuthenticationToken();
Label1.Text = "login success";
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri(gmailusername.Text));
this.lbcontacts.Items.Clear();
ContactsFeed feed = this.contactsService.Query(query);
if (feed != null && feed.Entries.Count > 0)
{
foreach (ContactEntry entry in feed.Entries)
{
this.lbcontacts.Items.Add(entry.PrimaryEmail.Address.ToString());
}
}
}
catch
{
Label1.Text="login failed";
}
}
}
Posted by
Vyas Pentakota
at
9:19 PM
Labels:
gmail contacts in .net web application,
google contact api,
vyas gmail contacts api
Subscribe to:
Posts (Atom)
