SharePoint 2010 General Lab for Developers (Part 1/5)



Prerequisites for this labs :


  • working knowledge of SharePoint 2010 (end users)
  • the SharePoint Object Model
  • Asp.Net
  • Visual Studio 2010
  • Part 1
  • Part 2
  • Part 3
  • Part 4
  • part 5


Starter files and solutions files can be found here.


In this lab we will Create features that will be reused in other tutorials.

Create a Visual Studio 2010 SharePoint project named CourseSiteFeatures.

The first feature you will have to create should display a menu item in the Site Action menu as illustrated in the next picture :


When the user will click on this menu item, an application page (createcoursite.aspx) will show up :


To achieve all of this, create a feature named CreateCourseSiteAction (with Scope = Site); the following picture illustrates the CustomAction element of the feature element manifest:


Don’t forget to create the application page; deploy the package on a blank site and test your feature.

To be able to retrieve the appropriate GroupId and Location, check the following page in the SharePoint SDKs:

Step 2.

The second feature will have to be a visible menu in the site collection settings:


Here again, when we click on this menu item, an application page (admincoursesitecreators.aspx) must be visible:


The feature name must be CourseSiteCreationUserAdmins (with Scope = Site) and its elements.xml file must be something like this:


Don’t forget to create the application page; deploy the package on a blank site and test your feature.

Step 3.

The third feature, CourseSitefeature will activate the 2 previous features you created; the 2 previous features must be invisible and activated through the third feature (CourseSitefeature). Scope feature must be Site.



Make sure that when the CourseSiteFeature is activated, a List called Course Site Creators (based on the custom list template) is created in the site collection root.


Make also sure the list is destroyed when the feature is deactivated.

Step 4. Feature stapling

We want to create a feature named CourseSiteStapling that will staple the CourseSitefeature for a blank site.


You just have to install the feature to make sure the stapling will work: change your Visual Studio 2010 project deployment settings.

To test your work, create a new site collection based on the blank site. You will notice that your Course Site feature gets activated directly.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s