Sharepoint Lookup fields can be powerful additions to any list and can emulate some of the behavoir of a relational database within a Sharepoint site. This article will provide an overview of the Sharepoint lookup field, including how to add one to a list, create a site column that can be used from subsites, and implement extendable lookup lists and relations between lists. Future articles will describe how to use these powerful fields in combination with list item event receivers to further implement relational behavoir between Sharepoint lists.
Phase 2 offers hosted Microsoft SharePoint and provides expert support with the subscription.
What is a SharePoint lookup field? Let’s explore them by first setting up two lists that will be joined together with a look up field. In this case we will look at using one list as an extensible lookup list. This enables users with contribute permissions to add choices to a drop down control on the new and edit forms for the main list. Otherwise the standard choice drop down field must be updated by a user with manage list permissions.
Starting with a Team site, we will create a lookup list for region, and add this field to the Contacts list. First create a Contacts List then create a Custom List.
Create a contacts list.
Site Actions > Create > Contacts
Create a Custom list
Site Actions > Create > Custom List
For this demo the list names are Contacts and Region.
Creating a lookup field in one list is relatively easy. Go the the Contacts list, List Settings, Create Column. Select “Lookup”, and choose the Region list from the Get Information from Drop Down. Leave the column Title, and we are done.
Now we can go to the Region list, and add some regions. Then we can use those regions as we add our contacts.
Although this is a simple example, it sets us up to implement some kind of relataional database with Sharepoint lists.
Look for thenext blog in the series where I will show you how to set up a site column as a lookup field and use it from subsites as well. Finnally in part three we will look at using Event handlers to maintain relationships and uniqueness of key fields.