/// <summary> /// sets the correct phone number from a google contacts email /// </summary> /// <param name="stdEntry">The std entry.</param> /// <param name="phoneNumber">The phone number to set into the std entry.</param> public static void SetPhone(this StdContact stdEntry, global::Google.GData.Extensions.PhoneNumber phoneNumber) { var stdPhoneNumber = new PhoneNumber(phoneNumber.Value); if (phoneNumber.Home) { stdEntry.PersonalAddressPrimary = stdEntry.PersonalAddressPrimary ?? new AddressDetail(); stdEntry.PersonalAddressPrimary.Phone = stdPhoneNumber; } if (phoneNumber.Work) { stdEntry.BusinessAddressPrimary = stdEntry.BusinessAddressPrimary ?? new AddressDetail(); stdEntry.BusinessAddressPrimary.Phone = stdPhoneNumber; } if (phoneNumber.Rel == GoogleSchemaPrefix2005 + "mobile") { if (stdEntry.PersonalPhoneMobile == null) { stdEntry.PersonalPhoneMobile = stdPhoneNumber; } else { stdEntry.BusinessPhoneMobile = stdPhoneNumber; } } }
/// <summary> /// Adds a specific <see cref="SyncBase.DetailData.PhoneNumber"/> to the google address list of a google contact /// </summary> /// <param name="googleContact">The google contact.</param> /// <param name="stdPhoneNumber">The std phone number.</param> /// <param name="addressType">The address type.</param> public static void AddPhoneNumber(this Contact googleContact, PhoneNumber stdPhoneNumber, string addressType) { if (stdPhoneNumber == null || string.IsNullOrEmpty(stdPhoneNumber.ToString())) { return; } var phone = new global::Google.GData.Extensions.PhoneNumber(stdPhoneNumber.ToString()) { Rel = GoogleSchemaPrefix2005 + addressType }; googleContact.Phonenumbers.Add(phone); }