Showing posts with label SharePoint Features. Show all posts
Showing posts with label SharePoint Features. Show all posts

Thursday, October 1, 2009

Deleting Features from SharePoint

In one of my previous article I discussed about creating and deploying custom features to SharePoint server. Here I’m going to describe how you can remove a feature from SharePoint.

First log into your server and go to SharePoint central administration site (Figure 1).

Then move to "Operations" tab and select "Solution management" (Figure 2).

Now you can select the feature that you want to remove. If it its status is "Not Deployed", you can simply click "Remove Solution" (Figure 4) and for the “Deployed” solutions first you have to click “Retract Solution” (Figure 3) and then remove.


To me it didn’t work when I remove my solution and redeploy using same name.

Tuesday, September 29, 2009

Creating SharePoint Features

In this article I’m going to describe how to create SharePoint feature before look at custom web parts . Here I’m going to use Visual Studio 2008 and Visual Studio 2008 extensions for Windows SharePoint Services 3.0 to create my feature.

Creating the Feature

First create new SharePoint Empty project as shown in Figure 1. There select Fully Trust (Deploy to GAC) when prompt.

Then Add new SharePoint Event Receiver as shown in Figure 2 & 3.


And select the list to add event receiver. Here I’ll select Custom List (Figure 4).

Then open ItemEventReceiver.cs to write whatever you want when something happen, like Add new item, Update item and Delete item from the list. You can find commented methods for insert your code. I’ll show how you can get the ID of newly added item (Figure 5).

Deploying the Feature

Using Visual Studio 2008 extensions for Windows SharePoint you can easily deploy your feature to the SharePoint server. To do this you have to be in the server and you can deploy by right clicking on the project (Figure 6).

Then activate the "ProjectUpdateEventItemEventReceiver" at Site Settings --> Site Features.  

To me, it did not work when I tried to change the code and redeploy it. I had to use different name when I want to change the code.

After Deploying the feature you can check the result using EventReceiver-Installer for SharePoint.

You may notice new feature is activated for all the custom lists as above picture, now you can use same EventReceiver-Installer to delete unwanted events in other custom lists.