google api call only pulling 23 contacts out of 41
this is the code i'm using can someone tell me why i can only get 23 of my
41 contacts? they all have phone numbers, and first & last names... is
this a google api problem or is there a proble with my code?
if (Settings.Default.FirstRun || Settings.Default.AccessCode.Length == 0)
{
#region Google Login
// get this information from Google's API Console after
registering your app
var parameters = new OAuth2Parameters
{
ClientId = @"",
ClientSecret = @"",
RedirectUri = @"",
Scope = @"https://www.google.com/m8/feeds/",
};
string url =
OAuthUtil.CreateOAuth2AuthorizationUrl(parameters);
Process.Start(url);
AccessCode accessCode = new AccessCode();
DialogResult result = accessCode.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
parameters.AccessCode = Settings.Default.AccessCode;
// get an access token
OAuthUtil.GetAccessToken(parameters);
Settings.Default.AccessToken = parameters.AccessToken;
Settings.Default.RefreshToken = parameters.RefreshToken;
Settings.Default.Save();
// setup connection to contacts service
var contacts = new ContactsRequest(new
RequestSettings("notify", parameters));
// get each contact
foreach (var contact in contacts.GetContacts().Entries)
{
try
{
var i = 0;
var phoneNumber = "";
while (i <
contact.ContactEntry.Phonenumbers.Count)
{
if
(contact.ContactEntry.Phonenumbers[i].Value
!= null)
{
phoneNumber =
PhoneNumber(contact.ContactEntry.Phonenumbers[i].Value);
break;
}
i++;
}
if (contact.ContactEntry.Name.FullName != null
&& phoneNumber != "")
{
string[] arr1 = new string[] {
contact.ContactEntry.Name.FullName,
phoneNumber };
ListViewItem lvi = new ListViewItem(arr1);
listView1.Items.Add(lvi);
}
}
catch (Exception err)
{
//MessageBox.Show(err.Message);
}
}
}
No comments:
Post a Comment