Contact and Appointment Contracts in Windows 8.1
Windows 8.1 is set to make allow applications greater access to the People and Calendar data stores. The functionality will be exposed via contracts, the mechanism by which applications can send and consume messages from other applications and the operating system. The most commonly cited examples in Windows 8 are the Share (send and receive) and Search (receive only) contracts. It should be noted that contracts are an OS concept, applications cannot create their own.
The first People contract offers the ability to display Windows-drawn contact cards within an application. By having Windows handle the UI, the user gets a consistent experience across applications. This contact card can then be used to initiate other actions such as sending an email or initiating a phone call.
As you can see from the above image, the contact card is integrated into the application rather than being a separate side-bar window like we see in the Settings and Share contracts.
When invoking ShowContactCard, the application needs to specify where the contact card should not be displayed. In the above example, the excluded region is the list of email recipients. There is also an alternate version called ShowDelayLoadedContactCard.
This allows the application to display a partial card immediate, then fill in the rest of the details once potentially lengthy lookup operations have been completed.
Foundational Changes to Contact Management
In Windows 8 the People app managed the contacts list directly. With Windows 8.1 we instead get a centralized “Windows Contact Store” that can be queried by any application. These queries may use a combination of name, email address, and/or phone number.
When a query fails, a contact card is still shown with a virtual contact containing just the information provided by the application making the query. Users are offered the option to convert the virtual contact into a real one that is saved in their address book.
Since Windows is actually managing the UI, the application that displays the contact card never gets access to the information from the Contact Store.
The current plan is for Windows 8.1 to support the following action types:
- Video Call
- Map Address
In order to avoid cluttering the UI, contact cards only show the first three available actions based on the data in that contact. If more than three actions are available, email, call, and message will have priority.
Receiving a Contact Action
When the user clicks on a button in the contact card, the associated application is launched in a side-by-side mode. That application receives the action type as well as the Contact object itself.
Detailed information on registering an application as a contact action handler is not yet available. We do know that, like file and protocol handers, this registration will be done in the application’s manifest and that each action type is registered separately.
The email action will also be registered for any application that registers for the mailto protocol.
Adding Events to Calendars
In Windows 8.1 applications will be able to add events to the user’s calendar. This is done by creating an Appointment object and then invoking the OS to display the Add Event dialog. The user’s chosen calendar application is responsible for drawing the dialog and actually saving the record. This requires user confirmation; calendar entries cannot be added without the user’s explicit permission.
If the user does save the entry, a unique identifier will be returned to the application. This identifier can be used later to update the event.
Other applications are capable of registering themselves as the user’s calendar of choice. Details about how this will be offered is not available yet.
It appears that application’s will not be granted full programmatic access to the user’s contacts and appointments. This prevents developers from writing malicious programs that steal the information, but it also prevents the creation of many useful classes of application.
For more information you can watch the Build 2013 session titled Building Apps That Integrate with People and Events or review the MSDN documentation.
Keith Adams Dec 06, 2013