Today we will look at how data is represented in Sharepoint.
At the top of the data structure are the lists. It is basically what it sounds like, a list of things. The nature of the list items depends on what Sharepoint is used for. As a collaboration platform, there might be lists such as 'Tasks' and 'Calendars', which stores tasks and events; but as a Content Management System for a news website, there might be lists for 'World News' and 'Local News', where each list item are news items.
Each list item carries some data. A 'Tasks' list item will probably have data such as 'Due Date', 'Assigned to', 'Task' and 'Importance', for example, and each can be of a different data type - 'Due Date' will be a datatype of datetime, and 'Assigned to' will have a type of string. You might end up with something like this:
| # | Task | Due Date | Assigned to | Importance | |---|---------------|------------|-------------|------------| | 1 | Get laundry | 24/08/2014 | Daniel | Low | | 2 | Buy groceries | 24/08/2014 | Daniel | High | | 3 | Pay Bills | 27/08/2014 | Daniel | Medium |
For the news website however, the list items will carry different data:
| # | Title | Tag Line | News Body | Author | Date | |---|----------------------------------------|------------------------------------|------------------------------------------------|---------------|------------| | 1 | Celebrity X separated with Celebrity Y | And we thought they'd last forever | It has shocked Hollywood... | Fay Mous | 24/08/2014 | | 2 | Famine in Country Z | Yet no one cares | It has been 15 consecutive years famine hit... | Mick Crowford | 22/08/2014 |
A column in Sharepoint is like a column in the tables above, it carries data of a certain nature. Columns are similar to fields in a MySQL database table, and indeed people do refer to columns as fields. Columns can be one of several data types, as listed below:
|SELECT THIS||TO DISPLAY THIS|
|Single line of text||Columns that collect and display small amounts of text in a single line, including text only, combinations of text and numbers, and numbers that are not used in calculations (such as phone numbers).|
|Multiple lines of text||Columns that collect and display one or more sentences of text or formatted text.|
|Choice (menu to choose from)||Columns that display a list of options.|
|Number (1, 1.0, 100)||Columns that provide a box in which you can type a numerical value.|
|Currency ($,¥, €)||Columns that provide a box in which you can type a monetary value.|
|Date and Time||Columns that store calendar or time-of-day information.|
|Lookup (information already on this site)||Columns that make it easy for you to select information that's already stored on a site.|
|Yes/No (check box)||Columns that store true/false information.|
|Person or Group||Columns that display the name of users or SharePoint groups.|
|Hyperlink or Picture||Columns that display a hyperlink to a Web page or display an image from the Web.|
|Calculated (calculation based on other columns)||Columns that display information that is based on the result of a formula. The formula can use information from other lists and columns, dates, or numbers. You can use standard mathematical operators.|
However, there are some fields/columns that are used on many lists, such as ID (as # in the tables above), and these would be better set as site columns. Site columns are the same as columns, the only difference is that they can be reincorporated into many lists, which saves you from typing . It also makes the site more organized - if a site column is updated, all lists which uses the site column can be updated at once.
Site columns are inheritable, which means any subsites will have these site columns available to them.
Content Types are a way of grouping related site columns together. For example, World News and Local News both have the columns 'Tag Line' and 'Author' (among others), and so we can group these columns together into a 'News' content type. The 'News' content type can be a part of a larger content type such as 'Document', and it will inherit any columns which its parent content type has. For example, all 'Document' content types have the columns 'Title', then if I make the 'Document' content type the parent of the 'News' content type, the 'News' content type will have the column 'Title' also.
...and back to lists
A list can carry data, and this data can be used to provide information for the website. We can use something call web parts to go through our list of 'News' and output the 'Title' and 'Author' columns on our news listings page. When the reader clicks on one of the new items, we can use a different web part to display all the data stored in that list item (news item).
However, the list doesn't have to contain just items of one type, it can hold multiple content types. In our news website example, the list can hold both the 'World News' and 'Local News' content types; in another example 'News Podcasts' list can hold both the 'Audio' and 'Video' content types, for either audio or video podcasts. When you create a list, you can import site columns and content types into the list.
When you create a list, multiple content types are not enabled by default. You'd need to go into 'Advanced Settings' to enable it. To enable this, go to General Settings, Advanced Settings and select Yes in Content Types to enable multiple content types.
When you create a new item on the list, you can choose from these different content types, and the form that is displayed will only show the relevant columns. In Sharepoint, there is a default content type that is automatically selected when you press 'New [something]', but you can also select from a drop-down list should you want to add list items of other types.
Data is stored in Sharepoint using lists, which are a bit like spreadsheets and a bit like database tables. A list contains columns to which it can be filled with data of a certain type. Site columns improves efficieny by saving you the time to redefine columns for many lists, and also improves consistency to prevent errors in repetitive tasks. Content Types are a way of grouping relevant columns together.
A list can contain a heterogeneous mix of items, and web parts process these lists to display meaningful data on the website.