Business Card (vCard) Support – NFC Library

The open source NFC library has received the first in a big series of updates, leading up to the next major release – full business card support, both for Windows Phone 8 as well as for Windows 8.1!

The library fully integrates with the two target platforms – you can directly take a contact from the address book and let the library create a vCard to write to a tag or share in peer-to-peer mode to another device. Of course, the NFC library also supports the opposite direction – parsing a vCard to a contact.

NDEF Library Windows 8 Demo App

Full Platform Integration

To make business cards useful in real scenarios, the library has to integrate with the way the target platform handles contacts. This is different for Windows Phone 8 and Windows 8.1:

Windows Phone 8

Microsoft is using two different classes for handling contact data – Contact is what you get when retrieving a contact from the address book, while ContactInformation is what supports converting to/from a vCard. Unfortunately, these classes don’t have a 1:1 matching and structure the data differently, with no built-in conversion method. Add into the mix that the vCard standard is again not a perfect match to either of those classes.

The NFC Library is now the first open source implementation that brings the three different standards together and has a comprehensive conversion algorithm to match them. This is especially tricky for the postal address, where I had to do a lot of experiments to get the matching right.

Windows 8.1

Unfortunately, the Microsoft WinRT APIs do not support vCards at all. As the vCard standard is hugely complex, I’ve integrated another open source library that can handle reading & writing vCard data. It is also licensed under LGPL license, so can be seamlessly integrated into the NFC library, which then adds the conversion to the Windows 8 Contact class to the mix and is able to match most of the properties.

The original vCard library has not been updated for several years, but still proved to be the best fit. To seamlessly integrate it into the NFC library use case, I have upgraded the project to a Windows 8 library context so that it can be easily included into the NuGet package. Additionally, I’ve already fixed some issues; e.g., the original library did not handle the types of postal addresses correctly. I will continue to enhance the vCard library in the context of the NFC library project!

Technical Background

To make platform specific additions possible, the library has now been extended into a solution containing several sub-projects: the generic C# library for any target platform, plus specific Windows Phone 8 & Windows 8.1 extensions. All of those parts are combined into one NuGet package, so that Visual Studio automatically determines which versions of the library are applicable to your target platform.


The updated version of the library is currently in alpha state and includes several other fixes – more about these later. It is currently available in source code format. We will update the official NuGet package once the next stable version is available.

The new version also updates the Windows Phone 8 demo app with business card support, as well as introduces a brand new Windows 8 NFC demo app that showcases many of the use cases of the library!

Categorized as News

By Andreas Jakl

Andreas Jakl is working as Mobility Evangelist at Tieto, to bring the business partner’s vision for mobile app strategies to life. In addition, he is organizing the Mobile Developer After-Work event series together with the community, where expert developers share their knowledge with plenty of time for networking. As Microsoft MVP for Windows Platform Development (Most Valuable Professional), he is also running developer trainings and workshops.