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

sergefacebook

 

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 :

clip_image002

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

clip_image004

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:

clip_image006

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: http://msdn.microsoft.com/en-us/library/bb802730.aspx

Step 2.

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

clip_image008

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

clip_image010

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

clip_image012

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.

clip_image014

<todo???>

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.

clip_image016

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.

clip_image018

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.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s