public void TestGetPhonebook() { phonebooksPhonebook phonebook = _fb.GetPhonebook("Telefonbuch"); Assert.IsNotNull(phonebook); Console.WriteLine(phonebook.name); foreach (phonebooksPhonebookContact contact in phonebook.contact) { Console.WriteLine($"{contact.uniqueid}\t{contact.person[0].realName}\t{contact.telephony[0].number[0].Value}"); } }
private Dictionary <string, string> GetPhoneBook(string userName, string password) { Dictionary <string, string> book = new Dictionary <string, string>(); Internals = new Dictionary <string, string>(); FritzClient _fb = new FritzClient { UserName = userName, Password = password }; phonebooksPhonebook phonebook = _fb.GetPhonebook("Telefonbuch"); foreach (phonebooksPhonebookContact contact in phonebook.contact) { Log.Debug($"{contact.uniqueid}\t{contact.person[0].realName}\t{contact.telephony[0].number[0].Value}"); foreach (phonebooksPhonebookContactTelephony phone in contact.telephony) { foreach (phonebooksPhonebookContactTelephonyNumber number in phone.number) { string dial = Align(number.Value); if (!string.IsNullOrEmpty(dial) && !book.ContainsKey(dial)) { Log.Trace($"\t->{dial}"); book.Add(dial, contact.person[0].realName); } if (dial.StartsWith("**6")) { string homephone = dial.Substring(3); if (!Internals.ContainsKey(homephone)) { Log.Trace($"\t(internal)->{homephone}"); Internals.Add(homephone, contact.person[0].realName); } } } } } return(book); }