XIMRX
XIMRX

Reputation: 2170

How to retrieve contact addresses in a string in windows phone?

Windows Phone contacts' details can be bind in UI like this and other details like emails, phone nos etc can also be retrieved by Enumerating Contact Data Results like this but I AM UNABLE TO USE ANY OF THESE TO GET "ADDRESSES" OF CONTACTS IN A STRING (the second link works great for all other properties but doesn't provide addresses)

Upvotes: 0

Views: 193

Answers (1)

Spaso Lazarevic
Spaso Lazarevic

Reputation: 906

Say, you have instance of your contact that you are looking for - contact and contactItem to put data:

Contact contact = App.con;
Dictionary<string,string> contactItem = new Dictionary<string,string>();

You could find all addresses with:

//Addresses
i = 0;
IEnumerable<ContactAddress> ad = contact.Addresses;
foreach (ContactAddress item in ad)
{
   i++;
   contactItem.Add("Adress " + i + " - " + item.Kind + ": ", item.PhysicalAddress.AddressLine1 + " " + item.PhysicalAddress.City);
}

Upvotes: 1

Related Questions