WinRT Contacts by ThinqLinq

WinRT Contacts

In preparation for recording a session of Deep Fried Bytes on the WinRT Namespaces, I scanned through the public ones in the Developer Preview to see what I could find. One of the interesting ones that I hadn’t heard about yet is the Contact class in the Windows.ApplicationModel namespace. This appears to be preparing for an integrated contact experience similar to the one found on the people hub on the Windows Phone. 

Similar to accessing files, music, pictures, etc, for contacts, you access them through the ContactPicker object. It has two main methods: PickSingleContactAsync and PickMultipleContactsAsync. Unfortunately, it appears that there is a bug in the PickMultipleContacts implementation making it unusable from type-safe languages at the moment. The WinRT samples do include a working version in JavaScript if you want to go that route.

The ContactInformation object supports the following properties: Name, Locations (addresses), Emails, PhoneNumbers, InstantMessages, and CustomFields. Custom Fields support Name, Value, Category and Type. With this, you can handle a wide variety of information about your friends.

I was able to create some sample code to get a contact:

Dim contPicker As New Windows.ApplicationModel.Contacts.ContactPicker
Dim contact = Await contPicker.PickSingleContactAsync()
Dim contactName = contact.Name

Unfortunately, when running this code on the current bits, the following message appears.

image

I guess we’ll have to wait until the store opens and contact apps start appearing to use it, or will we. If you open the Package.AppManifest and navigate to the Declarations, you can add the Contact Picker declaration to your package and your own search page and algorithm to search your proprietary store similar to how you can enable your application to search files from Facebook, Skydrive, Flicker, etc.

image

Posted on - Comment
Categories: VB Dev Center -
comments powered by Disqus