Converting a Stored Contact to and from a vCard

,

vCard is a standard file format used for electronic business cards. The stored contact API allows you to convert a StoredContact to and from a vCard.

The ContactInformation class contains a ParseVcardAsnc method, which asynchronously converts an IInputStream of vCard data and then returns a populated ContactInformation object, as demonstrated by the following example:

ContactStore store = await ContactStore.CreateOrOpenAsync();
ContactInformation contactInformation
    = await ContactInformation.ParseVcardAsync(inputStream);
StoredContact contact = new StoredContact(store, contactInformation);

Conversely, a StoredContact object is converted to an IInputStream of vCard data using the StoredContract class’s ToVcardAsync method, as shown:

ContactStore store = await ContactStore.CreateOrOpenAsync();
StoredContact contact = await store.FindContactByIdAsync(id);
IRandomAccessStream vcardStream = await contact.ToVcardAsync();

Being able to convert to and from the vCard format allows you to import and export contact information to and from other applications such as Microsoft Outlook.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.130.232