Tuesday, March 15, 2011

SharePoint 2010 Master Pages

The master pages SharePoint 2010 utilizes are features from ASP.NET 2.0. They provide the ability to lay out the framework of a rendered page separate from the page containing the content. While master page customizations were an essential feature in the previous version of SharePoint as well, there have been many notable and important changes from 2007 to 2010. This article attempts to:
  • Consolidate some of the basics of working with SharePoint 2010 master pages
  • Highlight some of the changes between the previous version and the new version 
  • Provide insight into some of the more common and useful customizations
Types of SharePoint 2010 Master Pages 

Default team site master page. Provides ribbon bar and other UI changes.
·         Site actions are updated for 2010 and appear on left.
·         Ribbon bar is available
Sites upgraded from SharePoint 2007 use this unless they are changed to use a v4 version.
Characteristics·         Site actions on right side and are same as SharePoint 2007 version
·         No ribbon bar.
minimal.masterMaster page contains almost nothing. It is used by the Search Center and Office Web Applications. This master should not be confused with minimal master pages from 2007 which were trimmed down custom master pages developed by users. The minimal.master is now an out-of-the box master page. These trimmed-down custom master pages are commonly referred to as Starter Master Pages in SharePoint 2010.
Characteristics of minimal.masterNo navigation included
Starter Master PagesCommonly referred to as “minimal master pages” in SharePoint 2007, these quick start pages are created by developers to better enhance their ability to quickly create and customize a functional master.
Sources for Starter Master Pages
Starter Master Pages for SharePoint 2010 by Randy Drisgrill

simple.masterThis master is used by login and error pages. To customize these pages, a replacement page must be created and stored in the _layouts directory on the server. For more information see Default Master Pages in SharePoint  on MSDN.
Pages using simple.master·
·         SignOut.aspx
·         Error.aspx
·         ReqAcc.aspx
·         Confirmation.aspx
·         WebDeleted.aspx
·         AccessDenied.aspx
Other Master PagesOther miscellaneous master pages are generally not manipulated when branding a site.
 These include:
·         application.master
·         applicationv4.master
·         dialog.master
·         layouts.master
·         layoutsv3.master
·         pickerdialog.master
·         rtedialog.master
·         simple.master
·         simplev4.master
·         mwsdefault.master
·         mwsdefaultv4.master
·         admin.master
·         popup.master
Upgrading a Master Page to a SharePoint 2010 Master Page 
This section draws from the MSDN article at http://msdn.microsoft.com/en-us/library/ee539981.aspx.
Many of the commands previously found in menus and toolbars now exist inside of the Ribbon. As a result, if the existing master page does not contain the Ribbon, many commands will be unavailable.
Controls on the Server Ribbon
These controls have been relocated into the Ribbon in SharePoint 2010:
·         Publishing Console -
·         Site Actions Menu -
·         Sign-in and Log-in Control (if using a custom login, it can be moved into the Ribbon).

Required Content Placeholders
Placeholder Control Description New
Top of the Quick Launch menu. Yes
Bottom of the Quick Launch menu. Yes
Title of the site. No
Placeholder in the head section of the page used to add extra components such as ECMAScript (JavaScript, JScript) and Cascading Style Sheets (CSS) to the page. No
The class of the body area. No
Control used for additional page editing controls. No
Name of the site where the current page resides. No
Title of the page, which appears in the title area on the page. No
Description of the current page. No
Section of the page for the search controls. No
Breadcrumb control on the page. No
Breadcrumb text for the breadcrumb control. No
List of subsites and sibling sites in the global navigation on the page. No
Container used to hold the top navigation bar. No
The navigation menu that is inside the top navigation bar. No
The placement of the data source used to populate the left navigation bar. No
Date picker used when a calendar is visible on the page. No
Top section of the left navigation bar. No
Quick Launch bar. No
Additional objects above the Quick Launch bar. No
Main content of the page. No
Container where the page form digest control is stored. No
Additional content at the bottom of the page. This is outside of the form tag. No
The class for the title area (now in the head tag). Customizations that add a WebPartZone in a content tag to this placeholder will cause an error. No
Not part of the UI, present for backward compatibility. No
Not part of the UI, present for backward compatibility. No
Not part of the UI, present for backward compatibility. No
Not part of the UI, present for backward compatibility. No
Not part of the UI, present for backward compatibility. No
Not part of the UI, present for backward compatibility. No
Not part of the UI, present for backward compatibility. No
Not part of the UI, present for backward compatibility. No
Not part of the UI, present for backward compatibility. No

refer by http://blog.allyis.com/blog/bid/48102/Working-with-SharePoint-2010-Master-Pages

Friday, March 4, 2011

Custom Content Types in SharePoint 2010

Content Types in Windows SharePoint Services (WSS) or SharePoint Foundation enables users to define and group meta-information about SharePoint content.
Typical use for Custom Content Types are in scenarios where a certain set of business specific data types need to be defined. For example if there is a business group that handles all policy making in a company they might want ‘New Policy Template’ and ‘Grandfather Policy Template’ to capture various policies in the company. Another example would be ‘Functional Specifications Template’ and ‘Technical Design Template’ for the engineering group. Such templates would mandate whenever a new document of the said type is created it should have a certain set of data. This set can be configured as a content type in SharePoint.

What metadata do Content Types save?

Simply put, Content Type is a set of field definitions. How are they different from standard Lists in SharePoint? Lists are specific to a location, content types are not. Content types in fact represent the blue print or schema definition that can be applied to a List or any other type of library for that matter. Content Types can also be scoped at site level such that they are available to an entire site hierarchy.
How to create Content Types in Sharepoint?
Content Types can be created in multiple ways
1. Through WSS/SharePoint Foundation User Interface
2. Through code using SP object model
3. Defining an xml based on a pre-defined schema and then deploying the xml as a SharePoint feature.
Each of these techniques deserves an article of its own. In this article, we’ll only cover the first technique.

Defining a Content Type using SharePoint Foundation User Interface
In the following example we will define a content type for a Functional Specification Document
Step 1: Log in a site collection administrator or Site Owner
Step 2: Navigate to Site Settings
Step 3: Under Galleries select ‘Site Content Types’

Site Content Types 
Step 4: In the Content Type Library select ‘Create’

Create Site Content Type

Step 5: Define the Content Type

Define Content Type 
a. Name: The name of the content type.
b. Description: Some help text describing what the content type is for.
c. Parent Content Type: Content Types can inherit from existing content types and they are grouped together by a Group Name
      i. Parent Content Type from: Select an existing group. Since we are defining a content type that will be used to   generate a document we use the ‘Document Content Type’ group
      ii. Parent Content Type: We want the content type to be applied when we are adding a new page to a page library in the site, so that each Functional Spec is published as a page.
d. Group: Select under which group our new content type should be categorized. Since it’s template for a Functional Specification Document we’ll categorize it under Document Content Types
e. Click Ok to complete basic content type definition

Content Type Def 
Step 6: Defining Columns
a. By default the content type inherits from the Page content type and gets the Name and Title columns.
b. Now we have two options, either we select columns that already exist or define new columns. 
    i. Let’s select some existing columns

       Content Type Columns
  • We select Author and Email columns from the existing set of columns 
  • While selecting the columns we get the option (Update all content types inheriting from this type?) to force our new columns down the entire content hierarchy. So if there are some other content types that inherit our content type we can force it down to those content types or just keep the changes for this content type.
  • Click OK to save changes

    Content Type Info 
  • As seen above ‘Author’ and ‘E-mail’ are both set up as Optional columns. But we would rather have these as mandatory. So click on each column to update their settings 
  • We can edit the Site Level column name too. Remember these are site level columns so changes affect the site. Let’s change the 20th century ‘E-mail’ to a more contemporary ‘Email’.

    New Site Column 

    ii. Add new columns: Let’s add new columns by using the Add from new site column link
1. Major Revision:
    a. Column Name: Major Revision
    b. Type: Choice
    c. Group: Custom Columns
    d. Additional Settings:
         i. Specify some descriptive text
         ii. Give choice values 1-10
         iii. Set default choice to 1
2. Minor Revision:
     a. Column Name: Minor Revision
     b. Type: Choice
     c. Group: Custom Columns
     d. Additional Settings:
          i. Specify some descriptive text
          ii. Give choice values 1-10
3. Approved By:
    a. Column Name: Approved By
    b. Type: Person or Group
    c. Group: Custom Columns
    d. Additional Settings:
        i. Description: Name of approver. Needs to be present in the SharePoint User List
        ii. Allow multiple Selections: Yes
       iii. Allow Selection of: People Only
       iv. Choose from: All Users
       v. Show Field: Name (with presence)
4. Table Of Contents
     a. Column Name: Table Of Contents
     b. Type: Full HTML content with formatting and constraints for publishing
     c. Group: Custom Columns
5. Problem Definition: Use same settings as 4b and 4c.
6. Functional Requirements: Use same settings as 4b and 4c
7. System Requirements: Use same settings as 4b and 4c
8. Open Issues: Use same settings as 4b and 4c
c. That’s it, we’ve defined a content type that roughly outlines what data we would like to capture as a part of our Functional Specification Document

Using a Content Type in SharePoint

Once we’ve defined the content type we are free to use it site wide. In our case we’ll create a new Page Library just to store functional specs. So navigate to existing ‘Libraries’ and click on ‘Create’.

Sharepoint Create Library
In the popup select ‘Library’ and ‘Document Library’.

Sharepoint Document Library
 Give a Name and click on More Options. Select settings as shown below and click ‘Create’

Now we’ve to tell SharePoint that for this document library use the newly define content type. To do this we need to apply following changes:
Step 1: Go to Site Settings and under Site Administration select Site Libraries and List to get to the list of available libraries.


Step 2: Click on ‘Customize “Functional Specifications Library” as shown in the screenshot above, to navigate to following page

Functional Spec Library Advanced 
Step 3: Click on Advanced Settings to enable content Management by selecting ‘Yes’ for Allow management of content types

Allow Content Type Management

Once we click okay we’ll see a new Content Pane is now visible in the List Information page

Sharepoint Add From Existing Content Type 
Step 4: Click on ‘Add from existing content types’ link to select our newly created content type

Select Content Type 
Click Ok to add the content types
Step 5: We don’t want users to use any other content type so we’ll ‘Change new button order and default content type’

Content Type Visible

To do this we make the Document content type invisible.

That’s it, we are done.

Creating a new page with our custom content type

Step 1: Navigate to the page library and select the Documents Ribbon. Then select the New Document pull down menu, you’ll see the newly defined template as the only template to select from

Sharepoint New Document 
Step 2: Select it and give a name to the new specification doc and click Create

Sharepoint New Specification Doc 
Step 3: SharePoint Foundation will pop up a rich text editor. This editor comes up based on the ‘Layout’ defined. Currently our page library uses the ‘Base Page’ layout. Hence it does not know what fields to show here. How to create custom layouts is a separate topic and out of scope for this article.

Sharepoint Rich Text Editor
Then how do we see our fields that we added in the custom type? Cancel out of the Rich Text editor and click on the Page ribbon tab.

Sharepoint Page Ribbon 
Step 4: From Edit Properties pull down menu, select View Properties.

Functional Spec Content Properties 
Step 5: Now you can see all the columns we defined for our content type
Step 6: Expand the popup to fill screen and click on Edit Properties

Edit Functional Spec Content Properties 
Step 7: Save changes and Check in. We are done.
We saw the steps required to setup a custom content types in SharePoint. This functionality is available in basic WSS 3.0 as well as SharePoint Foundation in other words it comes with your Windows Server license.
Custom Content Types gives you flexibility to define columns schemas independent of location.
This was a basic introduction. We can do a lot more with Content types and all the options that we did not use above.
What Next?
In subsequent articles I’ll be explaining how to make our Functional Specification ‘Page’ actually show the data that we entered through the content type. Then we don’t have to resort to ‘Edit Properties’ to add/update content values. This is achieved through another SharePoint feature – Layouts. We’ll also see how we can setup workflows for approval of our Functional Specification Document as well.