我正在尝试使用以下代码检索来自Google的相应标签的电话号码。
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
}
}
但是,我已将标签设置为我的Google帐户中的电话号码,例如“Home”,“Movile”,但这些值未被退回。我在这里错过了什么吗?
答案 0 :(得分:0)
Contacts API使用标准标签的rel
属性:
自定义标签保存在label
属性中,这两个属性互为独占described here。