Sitecore vCards

April 09, 2015 Mike Skutta

As part of our efforts to share the latest technologies and capabilities in the world of digital marketing and web development, we’ll be posting a series of articles on Sitecore, one of the most impressive experience platforms available today. Though this post will primarily be relevant to developers, we hope the content remains interesting to all of our readers and provides some insight into the more technical aspects of the digital development world.

Background

A vCard is essentially an electronic business card. Like a standard business card, vCards contain business related information about an individual or company. Usually this includes contact information such as the company name, the person’s name, address, phone numbers, email addresses and social media links. vCards can be attached to e-mail messages, shared through instant messaging, downloaded from web pages and distributed through various other forms of media.

Applications that maintain contact information, such as Microsoft Outlook, can import data from vCards into address books. vCards provide a way to electronically distribute contact information without the need for end users to key in the contact information manually.

A vCard is a file.
The file has a format specification that indicates how applications should create and read from the file. This gives the ability for a website to provide links to vCard files that client applications can open and understand.

When building websites that include contact information for people, it is usually beneficial to provide a link to download the associated vCard. As mentioned above, this saves the extra steps a user would need to go through to manually key in the contact information into their favorite electronic address book. It provides an overall better user experience.

Implementation on Sitecore

We wanted to make it as easy as possible to implement vCards on our Sitecore sites. We found that the source of the data contained within the vCards varies across our Sitecore implementations. This is typically due to differences in the data templates that represent a person. The best way for us to make vCard creation easier in Sitecore was to create a reusable API for the generation of the vCard file.

The API consists of a vCard object with properties that represent the data in the vCard file. Calling .ToString() on the object takes all of the data within the properties and returns a string that represents the vCard file in the proper format. We found this approach to be very flexible. The fields from the Sitecore item that represent a person are programmatically mapped to the properties on the vCard object. An ORM/Mapper can be used to make the mapping easier. The resulting string is then returned in a way that is compatible with the implementation. A Sitecore Web Form implementation may return the data differently than an MVC implementation.

We released this API to the community in GitHub. Feel free to use this API to help with your implementation of vCards.

Want to read more of our Sitecore tips and tricks? Check out the Express Subitem Module, allowing content editors to edit multiple child Sitecore items at the same time within the context of the parent item.

Interested in learning more or joining the team? Let's talk.

Subscribe
Mike Skutta Architect

As an Architect within the Technology Labs group at One North, Mike works to research, test and integrate new technologies for both One North and its clients. He is also a Sitecore Technology MVP – a distinction received by only 217 people worldwide – and holds more than 14 years of experience architecting, designing, developing software and leading technology teams. Based in Florida, Mike is often seen wheeling around the office via our robot.

  • Favorite vending machine snack: Doritos
  • Most unusual job: Working as a Serf at Medieval Times

One North Interactive 
222 North LaSalle St, #1500
Chicago, IL 60601

+1 312.469.1740