- Business logic
- application development
- Visual C#
- Visual Studio
- Microsoft Office
- Exchange server
- SharePoint 2010
- document management
- Web development
- Web sites
- Web Parts
- SharePoint Service Account
- SharePoint administration
Creating Custom Lists in SharePoint 2007
Custom Lists are one of the most commonly used items in both SharePoint Server 2007 and the previous version. This popularity stems from the fact that custom lists have the same function in SharePoint as a table in a databasenot just a place to store information, but also an entity that maps to a business need.
For example, suppose you need to store some data in SharePoint but you don't want to spend time creating UI Forms for data entry and updates, in other words, you want SharePoint to streamline the data management. This scenario is one possible use case for a custom list.
Lists strongly resemble database tables: Tables have columns and rows; similarly lists have columns to which you add items, forming rows. The simplicity of creating custom data storage provides huge benefits, because SharePoint can automatically provide a standard UI to manipulate the stored data, including the ability to add, update, and delete items. Moreover, SharePoint provides solid management features that let you set various list options as required. For example, you can apply built-in workflows to the items, or create your own workflows. You can also create "Event Receivers," essentially hooks to data actions that let you execute code whenever certain events occur. Table 1 shows a blank custom list. (Yes, it looks just like a table!)
|Column 1||Column 2||Column 3||.....||Column n|
Despite the many similarities between custom lists and database tables, there are also many noticeable differences. For example, custom lists do not provide support for transactions, so you can't roll back changes made to the data. Managing very large lists or including columns containing large data values within lists also presents performance challenges. You need some careful planning to get reasonable performance in large-scale lists. For example, when lists are likely to contain more than 2000 items, you need to consider such options as creating views (for data presentation) and subfolders (for data categorization). An excellent white paper on Microsoft TechNet explains the challenges of working with large scale lists, and provides workarounds for some of the problems.
Custom List Creation Options
SharePoint provides three ways to create custom lists as listed below:
- From scratch or from an existing list template using the SharePoint UI
- Via SharePoint Features
- Through the SharePoint API
The first method is the easiest, and the subsequent methods are each progressively more powerful. This article explores the first method: creating custom lists from scratch or from an existing list template using the SharePoint UI.
The difference between creating a custom list from scratch and creating one using an existing list template is that in to create a list from scratch, you use a list schema (with a possibility that the schema points to existing data). As an example, consider a SQL table-creation script. You can reuse that script multiple times to create a table. Custom lists are similaryou might want to create the same list multiple times in different SharePoint sites.
Procedure to Create a Custom List
The following procedure explains how to create a custom list, add a custom column to it and then add some data.
- Open the browser and type the following URL in the browser:
- From the Create Page , locate the "Custom Lists" section , and then click the first item, "Custom List" (see Figure 1).
- You'll see a "New" page (see Figure 2). Enter Sample List in the "Name" field , and type Sample Custom List in the "Description" field. Leave the Navigation option set to the default "Yes" value.
- Click the Create button to create the list. You'll see a new blank list titled with the text you entered in step 3 (see Figure 3).
- From the Settings menu, select "Create Column" (see Figure 4).
- In the Column Name field, type NickName. In the list of radio box options, select "Single line of text" (see Figure 5).
- Leave all other field values set to the defaults (see Figure 6), and click OK to add the column to your custom list.
- You will now see the list with your new column added, as shown in Figure 7.
Replace the SITE-COLLECTION-URL portion of the preceding URL, with the actual URL of the site collection where you want to create the list. Alternatively, from the default page, go to Site Actions View All Site Content, and then click the Create button.
|Author's Note: Knowing the URLs for commonly-used tasks (such as creating custom lists) saves time and acts as a shortcut.|
Figure 1. Creating a Custom List: Select the "Custom List" item from the Create options.
Figure 2. New Custom List Page: Fill out a name and description for the new list, and then click the Create button.
Figure 3. New List: Here's the new "Sample List" custom list, before adding any columns or items.
|Author's Note: SharePoint adds the "Title" column you can see in Figure 3 by default. While you can remove it, it's not recommended. However, if you definitely don't want the column in your custom list, here are some directions to remove it.|
Figure 4. Creating Columns: To create a new column, select the Create Column option from the Settings menu.
Figure 5. Column Properties: On this screen, provide a name for the new column and select the type of data it will hold.
Figure 6. Advanced Column Settings: Feel free to enter a description, but for this example, accept the default values for all other column settings.
Figure 7. Custom List with New Column: The figure shows the NickName column added to the custom list.
Now you can add some data. In SharePoint, rows are "items," so click New → New Item (see Figure 8).
Figure 8. Adding Items: Select New Item from the New menu to add a new item.
Figure 9. Populating New Items: SharePoint automatically provides an appropriate control type for each field.
Enter some text for the Title and NickName fields (see Figure 9).
Click "OK", to save the item. It will appear in the list, as shown in Figure 10.
Figure 10. New Item: After you save the new item, it appears in the custom list.
As you can see from this article, creating a custom list, adding columns to it, and creating new items in the list all quite simple tasks in SharePoint 2007. More importantly, you didn't need to write any code to create the custom list; SharePoint provides all the UI needed to create, modify, and populate the list.
A Developer.com eBook
Discover how to start developing for the Android platform with this extensive guide, which provides a reference to the Android platform as well as a look at developing your first Android application. You'll explore the top 10 features for developers as well as learn design and development tips that go beyond the phone and target tablet development as well.