Compartilhar via


Create Linked Lists in SharePoint 2010

SharePoint QuickStart Banner

Getting Started with Web Development in SharePoint 2010:  Learn how to create lists that are linked together in SharePoint 2010.

Applies to: SharePoint Foundation 2010 | SharePoint Server 2010 | Visual Studio 2010

In this article
Create the Lists on the SharePoint Site
Create Columns for the Lists
Add Data to the Lists
Next Steps

Published:  June 2010

Provided by:   Frank Rice, Microsoft Corporation

In this exercise, you create two lists in Microsoft SharePoint 2010. Then you create a lookup column in each list that links to data in the other list. To complete this task, you must do the following:

  • Create the Lists on the SharePoint Site

  • Create Columns for the Lists

  • Add Data to the Lists

Create the Lists on the SharePoint Site

In this task, you create two lists in SharePoint 2010.

To create the two SharePoint lists

  1. Open the SharePoint site you want to use in these procedures (such as https://localhost/sites/MySampleWebSite) in Internet Explorer.

  2. Click Site Actions, click More Options, and then click Custom List.

  3. In the Name box, type Employees, and then click OK.

  4. Click Site Actions, click More Options, and then click Custom List.

  5. In the Name box, type Projects and then click OK.

Create Columns for the Lists

In this task, you add columns to the two lists.

To create the list columns

  1. In the left navigation pane, click the Projects list, and on the ribbon user interface (UI), under the List Tools tab, click List, and then click List Settings.

  2. Scroll down to the Columns section and then click Create column.

  3. In the Column Name box, type Description, and then click OK.

  4. Scroll down to the Columns section and then click Create column.

  5. Name the column Due Date, specify its type as Date and Time and its format as Date Only, and then click OK.

  6. Navigate to the Home page.

  7. In the left navigation pane, click the Employees list, and on the ribbon user interface, under the List Tools tab, click List, and then click List Settings.

  8. Scroll down to the Columns section and then click on Title.

  9. Change the name of the column to Fullname and then click OK.

  10. Scroll down to the Columns section and then click Create column.

  11. Name the column JobTitle and then click OK.

  12. Repeat the previous steps to create the Team and Contribution (in Milestones) columns. Specify the type of the Contribution (in Milestones) column as Number. Click OK.

  13. In the Columns sections, click Create column.

  14. Name the column Project, and then specify its type as Lookup.

  15. In the Additional Column Settings section, set the Get information from drop-down box to Projects and the In this column drop-down box to Title.

  16. Now create a lookup column in the Projects list. Navigate to the Home page.

  17. In the left navigation pane, click the Projects list, and on the ribbon user interface, under the List Tools tab, click List, and then click List Settings.

  18. Scroll down to the Columns section and then click Create column.

  19. Name the column Primary Contact, and then specify its type as Lookup.In the

  20. Additional Column Settings section, set the Get information from drop-down box to Employees and the In this column drop-down box to Fullname.

Add Data to the Lists

In this task, you add data to the two lists.

To add data to the lists

  1. Navigate to the Home page and then click the Employees list.

  2. Add each row of data shown in Table 1 to the list by clicking Add new item, and filling in each column. Notice that as you fill in the Project column, you can choose from the list of items from the Title column in the Projects list.

    Table 1. Employees data

    Fullname

    JobTitle

    Team

    Contribution (in Milestones)

    Project

    Nancy Davolio

    Test Lead

    Testing

    2

    Writing more sample code.

    Robert Fuller

    Developer

    Development

    3

    Writing developer articles.

    Margaret Peacock

    Developer Lead

    Development

    2

    Writing developer articles.

    Janet Leverling

    Program Manager

    Testing

    4

    Answering forum questions.

    Lisa Miller

    Tester

    Testing

    5

    Building more developer tools.

    Joe Healy

    Tester

    Testing

    3

    Answering forum questions.

  3. Click the Projects list and then click Add new item and add the data in Table 2. Notice that as you fill in the Primary Contact column, you can choose from items in the Fullname column in the Employees list.

    Table 2. Projects data

    Title

    Description

    Due Date

    Primary Contact

    Writing more sample code.

    Customers need samples to write code from.

    12/31/2009

    Nancy Davolio

    Building more developer tools.

    Tools are fun to build and use.

    5/16/2009

    Lisa Miller

    Answering forum questions.

    Helping new developers to learn.

    6/15/2009

    Janet Leverling

    Writing developer articles.

    Everyone needs more details.

    4/15/2009

    Robert Fuller

Next Steps