I'm trying to retrieve phone numbers with respective labels from Google with the following code.
RequestSettings settings = new RequestSettings("myapp", username, password){
UseSSL = true,
AutoPaging = true,
PageSize = 5000
};
ContactsRequest c = new ContactsRequest(settings);
Feed<Contact> feed = c.GetContacts();
foreach (var entry in feed.Entries)
{
foreach (PhoneNumber phoneNumber in entry.Phonenumbers){
Debug.Write(phoneNumber.Label ?? "Empty"); //Always null!
Debug.Write(phoneNumber.Value ?? "Empty");//Have value
}
}
However, I had set label to the phone numbers in my Google account such as "Home", "Movile", but those values are not been returned. Am I missing something here?
The Contacts API uses the
rel
attribute for standard labels:Custom labels are held in the
label
attribute, and these two attributes are mutually exclusive as described here.