C H A P T E R  3

Using SharePoint to Store Data

SharePoint provides containers called lists to store information. Microsoft provides many predefined list templates that you can use to build powerful applications in SharePoint. SharePoint also has a generic list that can be customized to fit specific requirements. Libraries are special kinds of lists in which each list item refers to a file. Data in SharePoint is organized by creating different types of content that consists of columns or data. Once the data is stored in SharePoint, custom views of the data can be created.

This chapter covers the different types of lists and will take you through exercises in creating and customizing these. Mastering how to use lists to organize and store data will enable you to build robust web applications.

You will learn about the following topics in this chapter:

  • Customizing lists and libraries
  • Creating site columns and content types
  • Adding custom actions
  • Creating and modifying views
  • Saving lists as templates
  • Using Lists and Libraries

When you want to store data in SharePoint, you create a list. You can use one of the predefined lists or create one of your own. Lists contain columns (called site columns) of data. In database terms, each list (table) contains list items (rows) with one or more columns (fields). Libraries are a special type of list. Whereas a list contains list items, libraries contain files. A field in a list is more commonly referred to as metadata in a document library because it is used to describe the associated file. Although you can attach files to list items, the file is not the main point of the list item. It is just another piece of information associated with that list item. In a library, the file itself is the main piece of data in the library.

images Note Metadata is data that describes other data. In a list, each column is considered a part of the data. In a document library, the file is the data, and the other properties (such as Title, Created By, and Modified Date) are the metadata that describes the data.

You can create most lists and libraries either in the browser or in SharePoint Designer 2010, but you have much more control of your list creations with SharePoint Designer. This chapter will help you determine when to use the browser and when to use SharePoint Designer.

List Templates

You create lists by using templates. Microsoft provides several templates that have common business or collaborative functionality. If a premade template does not fit what you need to do, you can use SharePoint’s generic template, which allows you to build a list to your specifications. Once you create your own custom lists, you can save them as your own list templates, as you’ll see later in this chapter.

Table 3-1 lists some of the supplied list templates and their uses.

images

images

Library Templates

As mentioned, a library is different from a list in that its focus is on the file contained in the library. Table 3-2 is a list of provided library templates.

images

images Note Microsoft also provides several lists and libraries with predefined functionality—but only if you first create a site from a specific site template. For example, if you create a Group Work Site, you will see Circulations, Holidays, Time Card, Phone Call Memo, and Whereabouts lists created for you. One of the reasons these are not supplied as templates is because of the dependencies between the different lists in the template. A Visio Process Repository site is another site template that contains a unique document library with the following six content types attached: Basic Flowchart (Metric), Basic Flowchart (US units), BPMN Diagram (Metric), BPMN Diagram (US units), Cross Functional Flowchart (Metric), and Cross Functional Flowchart (US units).

Creating Lists

As mentioned earlier in the chapter, you can create lists either in the browser or by using SharePoint Designer. After a list is created, you can do the following:

  • Add, modify, or delete columns
  • Modify list- or item-level permissions
  • Add, modify, or delete content types
  • Create custom views of the list data
  • Create a list template from the customized list

EXERCISE 3-1. CREATE A LIST IN THE BROWSER

EXERCISE 3-2. CREATE A LIST BY USING SHAREPOINT DESIGNER 2010

Configuring List Properties

After you create your list, you can configure and customize it. From permission settings to versioning, lists and document libraries are very flexible containers for storing information. With SharePoint Designer 2010, it is even easier than before to rapidly develop business applications without code.

As soon as you create a list in SharePoint Designer, you are presented with its settings page. As you can see in Figure 3-1, the page is divided into the following sections, which you can customize:

  • List Information
  • Customization
  • Settings
  • Content Types
  • Views
  • Forms
  • Workflows
  • Custom Actions
images

Figure 3-1. Contacts settings page in SharePoint Designer 2010

List Information:

The List Information area contains the name and description you gave the list when you created it. These can be edited by clicking the Name and Description links. This area also contains the following settings:

  • Web Address: The site - relative URL of the default view (which is typically the All Items view)
  • List ID: A number that uniquely identifies the list
  • Last Modified: The date that an item or setting was last modified
  • Items: A count of all items in the list, including folders

Customization

In this area, you can edit the fields (list columns) in the list and set the list’s permissions. When you click the Permissions for This List link, a browser window will open to the List Permissions Settings window. Permissions can be set only in the browser.

Settings

The Settings pane, shown in Figure 3-2, provides a place to set general and advanced settings for the list. Although most of these settings can also be set in the browser, there is one setting unique to SharePoint Designer: Hide from Browser.

Suppose you want to store Form templates in a document library and access those through web parts on your site, but you don’t want users directly interacting with the list. SharePoint Designer allows you to hide a list from the browser with just one click. You can still access content in the list, but it is hidden from the navigational controls on the site.

images

Figure 3-2. Settings pane.

EXERCISE 3-3. HIDE A LIST

Browser Settings

Although you can set various advanced settings in SharePoint Designer, such as versioning or content type management, there are some that you can set only in the browser (for instance, audience targeting). SharePoint Designer provides an Administration Web Page button on its Ribbon menu to take you directly to the list’s web settings page.

Managing Data

Because this chapter is about using SharePoint to store data, you will use the same scenario throughout this chapter, building on it as you move through the different features available to you in SharePoint to manage data through lists.

images Scenario The building maintenance department of the Black Box Company has decided to set up a SharePoint site to help manage the department’s daily work orders and to provide the rest of the company information on the building maintenance services available to the company.

Using Content Types

Whenever you create a new Microsoft Word document, it contains various properties. These properties (for example, author, title, subject, keywords, and comments) are used to describe the Word document. These fields and more are present in every Word document. They are index fields that can be used for searching. In other words, they are the key fields to help locate the document during a search. Furthermore, these same fields also appear in every other Microsoft Office application document. Each application’s document contains these same key fields. So, if you wanted to organize all of these documents that contain the same metadata but were each a different type of data, you could say that you have Word document types, Excel document types, and PowerPoint document types.

In SharePoint, a set of metadata about a piece of information is called a content type. Content types enable you to quickly replicate a set of site columns in a list or describe the properties of a document. By using content types, you can keep your data organized and structured. Content types, by definition, define the data they are associated with.

Microsoft defines a SharePoint content type as the attributes of a list item, a document, or a folder. Each content type can specify the following:

  • Properties
  • Metadata
  • Workflows
  • Information management policies
  • Document templates
  • Document conversions to make available
  • Other custom features.

In our scenario, the Black Box Company’s maintenance department wants to create a library to store all of their departmental documents. These include maintenance documents, repair instructions, schedules, and service contracts. Each type of document will contain the following common departmental key fields that will enable a search to find them faster:

  • Author
  • Publish Date
  • Subject
  • Category (for example, electrical or plumbing)
  • Keywords

Even though all of the documents share these common fields, they also need other fields specific to their document type. For example, a repair instruction would need the name of the piece of equipment to repair, and a service contract would have a start and end date. How can we manage each type of information in the same library?

SharePoint allows us to create individual content types, which inherit from a parent content type. So in our example, you could create a Department Document content type that contained all of the specific site columns, and then create individual content types for each type of content stored in the library, that would inherit its base fields from the Department Document content type. So, if youwere to create a Service Contract content type, youwould set its parent as the Department Document and then add any additional site columns, such as Start Date and End Date, to make up a Service Contract content type.

Once you have created all of the content types, you can then assign them to a list. You can choose whether the content type will appear in the New menu in the list or library.

You can do many things with content types, including these:

  • You can create special views of the list, filtering on content type.
  • You can associate document templates with a content type.
  • You can define a content type at a site collection level, and all subsites can inherit from that content type.
  • You can set the content type as read-only so it can’t be changed.

Adding and Modifying Content Types

SharePoint provides an easy way to add predefined content types to lists by including a Content Type Picker. To use the quick Content Type Picker, click the Add button on the Content Types pane in the settings window.

EXERCISE 3-4. CREATE NEW SITE COLUMNS.

EXERCISE 3-5. CREATE THE NEW CONTENT TYPE

EXERCISE 3-6. ADD SITE COLUMNS TO THE CONTENT TYPE.

EXERCISE 3-7. CREATE A CUSTOM LIST.

images

Figure 3-8. New Item form.

Using Special Site Columns

SharePoint provides a couple of Site Column types that have special functionality: the calculated column and the lookup column.

Calculated Columns

The calculated column is able to display data that is calculated from data already included in the list. It uses formulas similar to Excel and Access. Calculated columns can contain functions, column references, operators, and constants, as well as IF statements.

EXERCISE 3-8. CREATE A CALCULATED COLUMN

Lookup Columns

A lookup column is a Choice Column type that gets its values from another list. This makes lists more relational and allows you to use the same data in multiple lists without having to synchronize data manually. A lookup column stores a reference to its parent list item and not the actual data.

EXERCISE 3-9. CREATE AND USE A LOOKUP COLUMN

Using Document Sets

Document sets are new in SharePoint Server 2010 and enable management of a single deliverable, which can include multiple documents or files. A document set is a special type of folder that contains the unique attributes of the document set and the attributes and behavior of folders and documents. It has its own specific object model elements, metadata, and user interface. A common scenario for a document set would be a request for proposal (RFP) or a real estate contract.

An organization could create a special Document Set content type for each type of project they create. That content type would then define the approved content types for the project, common attributes, default items, workflows, information management policies, and so forth.

The following are some common considerations when deciding whether to use document sets:

  • There is no limit on the number of documents that can exist in a document set. Knowing that, if you use the Send To feature with a Document Set, the sum for all documents in a document set cannot be larger than 50 MB. Even though there are no limits, page load times are greatly affected at a number 5,000 and over. Great care is needed to design sites in full knowledge of these limitations.
  • There is no limit on the number of document sets that can exist in a document library, but the display of document sets is limited by the display threshold of about 5,000 items.
  • If you use routing, document sets that are sent to a content organizer will remain in a drop-off library and be moved to the appropriate location by the content organizer’s processing timer job.

To use document sets, you must have the Document Set feature activated. The Document Set feature is a site collection feature.

images Note To enable the Document Set feature, go to the settings page and under Site Collection Administration, click Site Collection Features. Once the features page opens, find the Document Sets feature and click Activate.

Working with Views

Views are ways to look at the data stored in a list. When you create a list, a default view called All Items is created. This enables you to see all the items in your list. You may want to create different views of your data depending on your use for it or your audience.

Although you can create different public views in the browser, SharePoint Designer gives you more control over creating views of your SharePoint list data. In this section, you will learn about creating, sorting, filtering, and grouping data.

Creating Views

You can see the views that a list has by looking at its settings page in the Views pane. All lists come with a default view called All Items. You can create your own views by clicking the New button. A dialog box then appears, prompting you for the name of the view and asking whether you want it to become the default view. After naming your view, click the filename of the newly created view to customize the view in the View Editor.

When you are in the View Editor, you can add or remove columns from your view by selecting Add/Remove Columns from the Ribbon menu. In the Displayed Fields dialog box that opens, you can select the columns to display, as shown in Figure 3-11. The view in the Page Editor will then reflect your changes. You can also set limits on the number of rows displayed, in case your list is long.

images

Figure 3-11. Adding and removing display fields

Sorting, Grouping, and Filtering

You can set the order that a list is displayed in your view by clicking the Sort & Group button on the Ribbon menu to access the Sort and Group dialog box, shown in Figure 3-12. Here you can sort a list based on any field that is available and can sort in ascending or descending order. You can also specify that you want the data displayed in groupings based on the sort order.

To filter your data, click the Filter button on the Ribbon menu. A dialog box assists you in creating filters. You can select a field to filter on and the criteria. You can combine fields by using And and Or.

images

Figure 3-12. Sorting and grouping

EXERCISE 3-10. CREATE A CUSTOM VIEW

Adding Custom Actions

The ability to add custom actions without the need for a developer is new in SharePoint 2010. It refers to the ability to add new actions to the list item menu and the Ribbon list view menu.

Custom actions are used to provide quick access to additional tasks related to the list it is attached to. For example, if you need to add additional values to a lookup list, a custom action linking to the New Item form for the lookup list would enable that to be accomplished more easily.

Custom actions have the following properties:

  • Sequence number: The sequence number determines the order in which the new custom action appears. Every menu item has a sequence number, and with a little experimentation, you will be able to determine what value to assign to your new custom action.
  • Rights mask: You can use the empty mask or you can specify a rights mask that defines which users can see the custom action. The rights mask can contain any of the special base permissions from the SPBasePermission member names found at http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx.

EXERCISE 3-11. CREATE A CUSTOM ACTION

Creating Your Own Template

SharePoint provides an easy way to replicate a customized list or library. Once you have finished customizing your list, you can save it as a template to use again on your site or on other sites.

You save the list as a template in the browser. SharePoint Designer provides a quick link on the Ribbon menu to the Save as Template page in the browser. Once you open the page, give your list template a filename, a descriptive template name, and a description. It is good practice to add detail in the Description field indicating the function of the list and any unique features. That way, when you create new lists in the future, you won’t mistakenly duplicate your efforts.

You can also choose to include content in your template. This is helpful if you want to seed the list with sample values, form templates, or lookup values. It is important to remember that item security is not maintained in the template, so if you have any private information in the list, saving it as a template is not recommended. Once saved, the list template is a file stored in the list template gallery, accessed from Site Settings. From there, you can export the template to use on other sites.

EXERCISE 3-12. SAVE A LIST AS A TEMPLATE

Summary

This chapter explained the differences between a list and a library. The chapter used a scenario to illustrate key concepts of using these lists and libraries to store data in SharePoint. Some of the key points to remember are as follows:

  • SharePoint stores data in a list or library.
  • Metadata is data that describes other data.
  • Site columns are specific types of data, such as date, number, or text.
  • Content types are made up of site columns, workflows, document templates, and information management policies.
  • More than one content type can be associated with a list or library.
  • In SharePoint Designer, you can now add custom actions to the list item and Ribbon menu.
  • Once you are finished creating a customized list, you can save it as a template, including its content.

images

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.197.213