MCj02305090000[1]

Today’s subject is something of a "back to basics" article. I talk about some very fundamental SharePoint concepts, but I’m adding a little bit of a twist. Lists and libraries, Views, and Web Parts are interrelated components. Sometimes it is hard to tell where one of them stops, and the next one begins. In this article, I’ll try to make those boundaries a little easier to find.

One of the great things about SharePoint is the way it hides the complexity of web design and data storage from the end user. When you want to add a piece of content – a Customer Contacts list, for example – to your page, just pick a web part, and "Poof!" like magic, there it is. But this simplicity and abstraction carries a down side, and that is potential confusion about exactly what it is you have just added.

What You See vs What You Get

Microsoft does little to allay this confusion within SharePoint itself. Consider the Add Web Parts dialog box…

image

(Note: You get to this by selecting Site Actions/Edit Page, then clicking on the Add a Web Part banner in a Web Part zone. Your available parts may vary.)

Notice that this section is entitled "Lists and Libraries", and it simply gives the name and description of the the publicly viewable lists and libraries on your site. As a typical user, you could be forgiven for thinking "If I want to add a new customer contact list to my site, I just pick this web part." Unfortunately, that isn’t what you would get.

For example, let’s say you have a web page that has a Customer Contacts "list" on it, and you want to add a new list, with different customers.

image

If you were to follow the instructions above to add a "new" Customer Contacts list, you would end up with the same list, displayed twice:

image

Obviously, this isn’t what you want.

The reason for this confusion is because when you add the "Contacts list" to the page from the Web Parts dialog, you aren’t actually creating a Contacts "list" at all. You are adding a "List View" web part, which points to an existing list. This is an important distinction. The web part you are adding does not contain the list itself. Rather it holds a "View" of the list.

So, What’s the Difference?

What you have been working with are three distinct, though related, elements:

  • The list (or library) itself
  • A view of the list
  • A List View web part

Lists and Libraries

Lists and libraries are the fundamental elements of storage in SharePoint. In many ways, they behave like database tables or spreadsheets. They have rows of elements called "Items". Each item has a selection of columns or fields which hold the actual information. A contact item, for example, will have fields defined for First and Last names, company, address, phone numbers, etc… A document library’s items will include the file itself, and could also have columns for such attributes as its title, author, ISBN number, or other information.

Note: For now, assume that all of the items in a given list or library have the same set of fields, or "schema"; but be aware that SharePoint has a feature called a "Content Type" which allows for exceptions to that rule.

Each site you create will have a number of lists and libraries pre-defined, depending on the template selected. You are not limited to the ones created by default, however. You can add more of your own. But you don’t do it through the "Add a Web Part" dialog. Instead, you use the "Create" option on the Site Actions menu.

image

Views

While a list or library contains your data, in order to see it, a "View" needs to be defined. With a view, you can tell SharePoint how to display the information contained in the list or library. You can define almost any subset of the columns, and their order; define how many items to show – both per "page", and in total; select from various display formats, and even set filters for which items to display.

You can define any number of views for each list or library. For example, you can have views that are pre-filtered by one of the fields, or which contain the same information in several different formats.

Typically, when a list or library is created, a selection of views appropriate to the expected content is also created. One of these views will be the "Default" view, which is what you will see when you click on the list or library’s name in the Quick Launch bar, or in the title bar of a web part. You select an existing view from the combo-box in the upper right hand corner of the display area, as shown below.

image

You can also create new views, or modify the existing view, from this menu. Views can be displayed as stand-alone pages, or within a List View Web Part.

List View Web Parts

This brings us back to where the article began. The web part labeled "Customer Contacts" in the dialog we started with is a List View Web Part. When a list or library is created, a corresponding List View Web Part is also created. (Note: It is still called a List View Web Part, even if it represents a library.) The List View Web Part allows you to place a list or library’s views on any web part page in your site.

In addition, using the List View Web Part means that you aren’t limited to showing lists or libraries just one time, or in just one place, or in one format. While each List View Web Part has a default View (typically called the "Summary View"), you can select any of the Views you have defined for the associated list. In addition, you can further refine the selected view within the web part.

You can, for example, have one view showing the list of contacts, with another view showing an individual contact laid out as a card. You could then use the Web Part Connections function to select which contact’s details to display, as shown below.

image

Summary

Lists and libraries, Views, and the List View Web Part are distinct, but related elements of every SharePoint site. Site managers need to be aware of how they related to one another. In general:

  • Lists and libraries define and hold the content of your site,
  • Views define how to display that content, and
  • List View Web Parts allow you to select where to display the content.