Reading the Feature.xml or Elements.xml file that has been installed to sharepoint

What I want is to be able to see what has been installed to sharePoint, not what is on the hard drive in the Features folder. For example I had some properties in my Feature.xml file like this:

  <Property Key="LibraryName" Value="Custom Images" />

After installing and activating the feature I noticed some properties were missing, so I added the properties to the Feature.xml file.

At this point what is installed to SharePoint is different to what is on the hard drive. I know I have to remove and re-add the feature, but I need some way of reading what has been installed for troubleshooting purposes.

3 Answers 3


I suppose you're looking for the SharePoint feature upgrade framework. It will allow you to use feature versioning and perform some custom upgrade actions. However, this is not an easy thing, so you'll need to investigate it intently.

Chris O'Brien SharePoint MVP has article series about this:

  • I had been wondering how to uppgrade a feature, this looks very useful and worth further investigation.
    – PeterM
    Sep 16, 2011 at 10:40

By using feature receiver you can get path to feature folder with property SPFeatureReceiverProperties.Definition.RootDirectory and when get any file from this folder.


SPFeatureReceiverProperties.Definition Property

SPFeatureDefinition.RootDirectory Property

  • I take it this can only be done when activating a feature? Ideally I wanted some kind of stsadm command or a database query to get the information.
    – PeterM
    Sep 16, 2011 at 9:19
  • @PeterM, FeatureActivated will be executed after your new Feature.xml will be copied to 14 hive. So, this approach will work only if you place the code in some other feature, and activate it first. Sep 16, 2011 at 9:45
  • Ok, I wrote a quick client program in VB on my image. This gives me feature.xml. Now I need the elements.xml Dim Feature As SPFeature Dim xml As System.Xml.XmlNode Using sitecollection As SPSite = New SPSite("WSS3") Using Site As SPWeb = sitecollection.OpenWeb() Feature = Site.Features(New Guid("00BFEA71-52D4-45B3-B544-B1C71B620109")) xml = Feature.Definition.GetXmlDefinition(New System.Globalization.CultureInfo("en-gb")) MessageBox.Show(xml.OuterXml) End Using End Using
    – PeterM
    Sep 16, 2011 at 9:59

SharePoint Feature Administration and Clean Up Tool is an excellent tool to help you accomplish your goal. Of course you can:

Find faulty FeatureDefinitions and cleanly uninstall them.

Find Feature remainders in Sites, SiteCollections, WebApps and in the Farm, from e.g. forcefully uninstalled Features from farm without deactivating them before, causing errors. Also, de-/activate Features Farm wide.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.