Unfortunately the WinFS Contact schema for addresses is pretty ugly in the PDC build.
We're working to fix it, but for now you're going to have to live with some pain.
Person.PersonalAddresses is just there to trick you. The shell UI isn't actually
hooked up to it. We used to use it and store the information in a PostalAddress,
but then someone invented Locations and we thought it would be cool to use them instead
(I blame Walter). Sadly, we couldn't convert
all the code right away so we had to leave the PersonalAddresses collection in place.
I think everything is converted by now, but we didn't take it out for the PDC just
so we could confuse everyone. Sometimes we suck...
So, you should use Contact.Locations instead. If you look at the schema you'll
see that Contact.Locations is a collection of WinFS.Links. That means this isn't
as easy to use as the Person.PersonalAddresses collection. You' ll have to do
a FindOne for the target of each link and build your own collection. This will
become much nicer and cleaner with the next batch of WinFS changes, but for now the
code below may help.
using WinFS = System.Storage;
internal static ArrayList GetAddresses(WinFS.Contact.Person p)
{
ArrayList coll = new ArrayList();
foreach (WinFS.Link linkLoc in p.Locations)
{
string strFilter = "ItemIDKey=" + WinFS.Util.ByteArrayToHexString(
linkLoc.TargetKey);
WinFS.Core.LocationElement loc = WinFS.Core.LocationElement.FindOne(
p.ItemContext, strFilter);
if (loc != null && loc is WinFS.Location.Address)
{
coll.Add(loc);
}
}
return coll;
}
All I can say is sorry...