Chapter 6. Contacts and calendars
This chapter covers
- Searching for contact data
- Reading calendar appointments
- Creating a custom contact store
- Adding custom contacts
A modern mobile device is much, much more than a conveniently wireless telephone. For many people, the phone has replaced their appointment book and telephone directory. Phone numbers and email addresses are stored in the phone’s contact list. Appointments and meetings are viewed using the Calendar application. Windows Phone developers access these mobile phone features via the UserData APIs.
As we discussed in chapter 5, the Windows Phone security model doesn’t allow third-party applications to directly access the native data stores provided by the operating system. Access to native data stores, specifically the contacts and calendar data stores, is exposed through the Contacts and Appointments classes found in the UserData API.
In this chapter we’ll explore the UserData and ContactStore APIs. You’ll learn how to read contact and appointment data stored in the phone’s People Hub and Calendar application. You’ll create a custom contact list, and you’ll build an application to demonstrate how to use the UserData and ContactStore APIs. In the first half of the chapter, you’ll build features that search for contacts and appointments in the native data stores. After that, you’ll create a custom contact store and add features to add, edit, and delete contacts owned by the application.