Freigeben über


Read-only access to Contacts and Calendar for Windows Phone 8

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

This section describes how to implement read-only access to the user’s contacts and calendar data. Windows Phone supports letting the user choose from a list of their contacts and sending them emails, searching for contacts’ birthdays, finding appointment times, and many other scenarios. For information on creating a read/write contact store for your app, see Custom contact store for Windows Phone 8.

This topic contains the following sections.

Aggregated data sources

Windows Phone provides an aggregated view of the user’s contact data across the user's different accounts. Info can come from sources such as data entered in the phone itself, social networking sites, and other data service providers. Not all data from all service providers is exposed publicly through the contacts and calendar API. The StorageKind enumeration lists the possible sources of data.

The following table summarizes what data is available from each provider.

Data provider

Contact name

Contact picture

Other contact data

Calendar appointments

StorageKind enumeration

Windows Phone Device

Yes

Yes

Yes

Yes

Phone

Windows Live Social

Yes

Yes

Yes

Yes

WindowsLive

Windows Live Rolodex

Yes

Yes

Yes

Yes

WindowsLive

Exchange Accounts (Contacts are from the local address book only, not the global address list.)

Yes

Yes

Yes

Yes

Outlook

Mobile Operator Address Book

Yes

Yes

Yes

No

Other

Facebook

Yes

Yes

No

No

Facebook

Windows Live Aggregated Networks (Twitter, LinkedIn, and so on)

No

No

No

No

None

Contacts created with the ContactStore APIs

Yes

Yes

Optionally (see note)

No

Other

Note

Contact name and contact picture are available for all contacts created with the ContactStore APIs. Other contact data is available only if the contact store was created with ContactStoreSystemAccessMode.ReadOnly specified in the call to CreateOrOpenAsync

Best practices

Following are some best practices for creating apps that are ready for the Windows Phone Store.

  • Before you access contact and calendar data, you should obtain the user’s permission and provide a privacy policy. For more info, see requirement 2.11 in the App policies for Windows Phone.

  • There are CAPABILITY elements in the app manifest file that correspond to accessing contact and calendar data. For more info, see App manifest file for Windows Phone 8.

  • Contact data is provided as a read-only snapshot. If your app needs fresh data, repeat the original search periodically.

  • Contact data can vary widely in size. Be prepared for very large contact lists by providing a message to the user when you are loading data.

  • Use the built-in filter searches, which are pre-indexed to be fast, instead of LINQ whenever possible. For more info, see Contact filtering and matching for Windows Phone 8.

Title

Description

How to access contact data for Windows Phone 8

Lists the steps for accessing contact data, and demonstrates how to bind the results to the UI or to enumerate through the results. Also contains a LINQ example.

How to access calendar data for Windows Phone 8

Lists the steps for accessing appointment data, and demonstrates how to bind the results to the UI or to enumerate through the results. Also contains a LINQ example.

How to display the photo of a contact for Windows Phone 8

Lists the steps for displaying the photo of a contact, either by calling the GetPhoto method directly, or by data-binding through a custom data converter.

Contact filtering and matching for Windows Phone 8

Describes how to use the built-in filters when searching for contacts, and describes how the filter strings are matched against the name, email, and phone number data.

Walkthrough: Accessing contact and calendar data for Windows Phone 8

Walks you through the procedures to build and test a simple contacts and calendar app.

Reference

Microsoft.Phone.UserData

Contacts

Appointments

See Also

Other Resources

Code Samples for Windows Phone