Querying the List Schema for Choice Fields

Version: 1.0.0

Description

SharePoint choice list columns provide the flexibility to add and change the values available to end users. For example a Contact list may contain different types of contacts: Customers, Vendors, Suppliers, Etc. When writing applications that use such a list, it is a best practice to request the list schema and load the list of choices dynamically so that changes to the list do not require recompiling the application.

Overview

SharePoint choice list columns provide the flexibility to add and change the values available to end users. For example a Contact list may contain different types of contacts: Customers, Vendors, Suppliers, Etc. When writing applications that use such a list, it is a best practice to request the list schema and load the list of choices dynamically so that changes to the list do not require recompiling the application.

In this lab, you will create an application that reads a Contact list with a custom choice field. You will use the SharePoint Lists Web service to get the available values for the choice field so that your application provides the same field validation the user would receive while working with SharePoint in a web browser.

Objectives

In this hands-on lab, you will learn how to create a Windows Phone 7 application that connects to a Contact list to display contact details including a Choice field. This lab details how to query the Lists Web service to determine the choices available for a field.

  • Learn how to use the SharePoint Lists Web service to query the list schema.
  • Learn how to use Linq to determine the Schema for a specific field.
  • Learn how to populate a ListBox control with the correct values from the list schema.

Prerequisites

The following is required to complete this hands-on lab:

Note:
See Setting Up A SharePoint and Windows Phone 7 Development Environment Module for instructions that describe how to set up the SharePoint and Windows Phone 7 developer machine.