Web collaboration consultant, public speaker and Microsoft Press Author. @resing on twitter

Create a SharePoint Custom Action Feature with VSeWSS

Reposted at new location. Orginally published 20-Oct-09

If you are a SharePoint Developer and are not using Visual Studio 2008 Extensions for Windows SharePoint Services yet, please read Paul Andrew detail how VSeWSS 1.3 March 2009 CTP addresses all common SharePoint Developer requests.

When you are using the extensions, the first thing you might try to do after watching Kirk’s video is use the MOSS SDK Empty SharePoint template to create a very basic feature whose Element Manifest might look like this:

Element Manifest

  Download ElementManifest1.xml

Warning: Don’t User Add New Item to Create your Manifest!

When adding a new Element Manifest in VSeWSS, the method you use is very important.

Don’t use Add | New Item to create a new xml file and type in the above code manually.

You will be able to add the new xml file to the project, but WSP View will not pick it up when you add it this way. If you edit the feature.xml to refer to it, your change will be reverted automatically.

image

Method 1: WSP View Create New Feature

Step 1 is the same for both Methods. Create a new Visual Studio Project using the SharePoint SDK Empty template. This will give you an empty project with the correct SharePoint References and just a manifest.xml in WSP View.
Click to Zoom

Step 2: From WSP View, hit Refresh to show the Solution name in the window and expand the solution to see the Manifest.xml. Click the Create new feature button to open the create new feature dialog.
image

Step 3: For the simplest custom action feature, select Web scope and check “Add default element.xml file.”
image

Result: A new feature and a new element in your WSP View with the corresponding .xml files created. And, you will see a new Element1.xml file in your Solution Browser. Double click Element1.xml to open in the text editor to add your action. You can paste the code inside my ElementManifest1.xml CustomAction Element for a quick example of a new Site Action. Make sure that you don’t remove the Elements ID attribute that was generated by VSeWSS .

imageimage

Method 2: Add | Exisiting Item

  1. Repeat Step 1 from Method 1, then download ElementManifest1.xml to your local hard drive.
  2. Right click the project in Solution Explorer and select Add | Existing Item.
  3. After you select ElementManifest1.xml, you will see it appear as in the results above for Method 1.
    1. The ID Attribute will be generated by VSeWSS and inserted into Elements element of the file
    2. A reference to the manifest will be added to feature.xml.

Result
image

Notes

Double click on the feature or element name in WSP View to rename the feature or solution.
image

Right click Deploy from the Solution explorer and your new solution will be added, deployed and your feature activated on localhost:80 by default.
image

VSeWSS 1.3 always deploys an assembly in the manifest.xml even in cases like this where it is not necessary
image

Leave a Reply