SharePoint Site Columns

In this second part of a four-part series on SharePoint lists, we discuss adding, customizing, and creating site columns. This article is excerpted from Essential SharePoint 2007, Second Edition, A Practical Guide for Users, Administrators and Developers, written by Jeff Webb (O'Reilly, 2008; ISBN: 0596514077). Copyright © 2008 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Contributed by
Rating: 5 stars5 stars5 stars5 stars5 stars / 7
January 08, 2009
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

Why Use a Lookup? 

Lookup and Choice column types serve similar purposes. Both provide choices from a list of values. With Choice columns, the values are entered directly in the column settings. With Lookup columns, the values come from another list.

Why go to the trouble of setting up a whole list just for a lookup? Because changes to the lookup list appear automatically in the Lookup column. To see how that works:

  1. Select Charles Murphey as an assistant in the first row of the Phone List as shown in Figure 4-6, and then change his first name to Charley in the fifth row of the Phone List.
  2. Click Actions -> Show in Standard View, and “Charley Murphey” now appears in the first row.
  3. Finally, click on Charley Murphey in the first, and you’ll see his contact details. Lookups link lists together!

In this case, you’ve got to enter assistants before you enter managers (otherwise, you won’t be able to find their assistant). That’s always true of lookups: the source list must contain the values you want to look up before you can fill out the destination list.

Lookups can be used across any list or library in the current site. For example, you might add a Lookup column to a Task List that gets its values from a library containing Contracts. Each task then links to the contract that spells out the exact terms of the task as shown in Figure 4-7.


Figure 4-7.  Using Lookup columns to drill down to a contract from a task list to a document

Adding Site Columns

One thing you’ll notice when working with lookups is that you can’t look up values from a list in another site. Lookups can only get values from lists in the current site. To get values from another site, you need to create a site column.

SharePoint provides quite a few built-in site columns for general types of lookups. To add one of the built-in site columns to a list:

  1. On the list toolbar, click Settings -> List Settings, and scroll to the end of the Columns list.
  2. Click Add from existing site columns (it’s the second link after the end of the columns list). SharePoint displays the Add Columns from Site Columns page.
  3. To add a site column to a list, select the column from the list on the left and click Add; then click OK. Figure 4-8 shows adding a Gender column to the Phone List.


Figure 4-8.  Adding a site column to a list

The Gender site column is a simple choice column containing Male/Female options. The advantages of using a site column in this case are:

  1. You don’t have to create your own Gender column each time you want to provide this choice.
  2. The choice is consistent across sites: it’s always Male/Female, not M/F, or Yes/No (just kidding).

Customizing Site Columns

Most of the built-in site columns are simple text or date columns that include the name and description of the column. Exceptions to that rule are listed in Table 4-3.

Table 4-3. Special built-in site columns

Site column Values
Append Only Comments Multiline text: can only add text, not change or delete
Assigned To Lookup from site users
Gender Choice: Male/Female
Issue Status Choice: Active/Resolved/Closed
Language Choice from list of spoken languages
Priority Choice: (1) High/(2) Normal/(3) Low
Related Issue Lookup from Issues list
Status Choice: Not Started/Draft/Reviewed/Scheduled/Published/Final/Expired
Task Status Choice: Not Started/In Progress/Completed/Deferred/Waiting on someone else
UDC Purpose Choice: Read Only/Write Only/Read Write

You can change the choices for most of these site columns—interestingly, you can’t change the Gender site column. For example, to simplify the Status choices:

  1. Navigate to the top-level site in the site collection.
  2. Click Site Actions -> Site Settings, and then click Site Columns under the Galleries heading in the middle of the page. (In MOSS, click Site Actions -> Site Settings -> Modify All Site Settings.)
  3. Scroll to the bottom of the page and click the Status link just above the Core Task and Issue Columns heading. SharePoint displays the Change Site Column page.
  4. Scroll down and delete the Scheduled and Published choices from the list under the Additional Columns Settings heading; then click OK. SharePoint changes the list of choices for all lists that use the column.

Removing choices from a site column doesn’t change the data in lists, it just changes the choices displayed when a user adds a new item to a list or edits an existing item.

Creating New Site Columns

Site columns share values across all of the sites within a site collection. They are set at the top-level site in the site collection, and those changes aren’t shared with other site collections.

You create new site columns to share values across all sites in a collection. A Department Lookup column makes a good example, since it’s best to have a single place to maintain the list of departments in case of a reorg. To create a Department site column complete these tasks:

  1. Create a Departments list in the top-level site and add items to the list.
  2. Delete the built-in Department site column. That column is a text column, so we’ll be replacing it with a Lookup column.
  3. Create a new Department site column that looks up its values from the Departments list.
  4. Add a new custom Department site column to the Phone List sample.

To create a top-level Departments list:

  1. Navigate to the top-level site in the site collection.
  2. Click Site Actions -> Create, and click Custom List under the Custom Lists heading. (In MOSS, click Site Actions -> View All Site Content -> Create.) SharePoint displays the Site Column Gallery page.
  3. Name the list “Departments,” select No for “Display this list on the Quick Launch,” and click Create. SharePoint displays the new list.
  4. Click Actions -> Edit in Datasheet and enter a list of your company’s departments.

To delete the built-in Department site column:

  1. Click Site Actions -> Site Settings, and then click Site Columns under the Core Contact and Calendar Columns heading. (In MOSS, click Site Actions -> Site Settings -> Modify All Site Settings.) SharePoint displays the Change Site Column page.
  2. Scroll to the bottom of the page and click Delete. SharePoint displays a warning. Click OK to delete the column.

To add the new custom Department column:

  1. On the Site Column Gallery page, click Create. SharePoint displays the New Site Column page.
  2. Complete the page as shown in Figure 4-9 and click OK. Name the column “Dept” as shown; we’ll change that next.
  3. Click on the Dept column in the Site Column Gallery and change the name from Dept to Department; then click OK.

You can’t name the new column Department directly—that name is reserved by SharePoint. That’s why you have to name it Dept; then change that name to Department in step 3. That create-and-rename trick solves similar problems in other places, so please remember it!


Figure 4-9.  Creating a custom site column using a lookup from the Departments table

To use the new Departments site column in the Phone List sample:

  1. On the Phone List toolbar, click Settings -> List Settings, and click the Department column in the columns list.
  2. Rename the Department column “Department Old” and click OK.
  3. Scroll to the end of the Columns list and click “Add from existing site columns.”
  4. Select the Department site column, click Add, and then click OK.
  5. Display the Phone List and click Actions -> Edit in Datasheet.
  6. Select the values in the Department Old column and drag them to the Department column. SharePoint moves the values from one column to the other.

After you move the values, you can delete the Department Old column from the Phone List and update the view used by the web part on the home page.

Please check back next week for the continuation of this article.

blog comments powered by Disqus
BRAINDUMP ARTICLES

- Microsoft Windows 8 Committed to Cloud Compu...
- Independent Developers Favor Windows Phone 7
- Dell Introduces VMware-based Cloud
- Microsoft and Skype Agree to Acquisition Deal
- Transfer Contacts in Microsoft Outlook
- Zune`s Next Steps
- Safari Books Online Review
- Does Microsoft Get Touch Screens Now?
- Microsoft`s Record Quarterly Earnings Not En...
- Basic Operations and Registers in Assembly
- Assembly Coding within Visual C/C++ IDE
- New Microsoft Office Coming with a Twist
- Microsoft`s FUSE Labs Unveils Spindex Social...
- HP Slate with Windows 7: Dead or Alive?
- Windows Phone 7 Mobile OS to Rival Android a...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials