Reader Level:

Features in SharePoint 2010 Programmatically Using VS 2010

Posted by Vijay Prativadi Articles | SharePoint July 29, 2012
Today, in this article let’s play around with one of the interesting and most useful concepts in SharePoint 2010.
  • 0
  • 0
  • 4158

Features in SharePoint 2010 programmatically using VS 2010


Today, in this article let's play around with one of the interesting and most useful concepts in SharePoint 2010.

Question: What is a feature?

In simple terms "It is a set of functionality that can be activated or deactivated at the farm, site or web level".

I think we are now good to go and implement this wonderful concept.

Step 1: Create a custom list and modify the view

Step 2: Open SharePoint 2010 Central Administration and navigate to a specific site

Step 3: Open Visual Studio 2010 and create an "Empty SharePoint Project", as in:


Step 4: Select "Deploy as a farm solution" and click the next button. Now an empty project will be created.


Step 5: Click on the feature and add the feature details and later also right-click on the feature to add the event receiver:


Step 6: The complete code of EventReceiver.cs looks like this:

using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
namespace FeatureApplication.Features.AzureFeature

Step 7: Deploy the solution file and add the created webpart to the SharePoint site.

Step 8: The output of the application looks like this:


Step 9:
The output of the feature activated application looks like this:


Step 10:
The output of the feature deactivated application looks like this:


I hope this article is useful for you. I look forward for your comments and feedback.. Thanks Vijay Prativadi


Trending up