Is there a relative URL for files hosted in the TEMPLATE\FEATURES directory?

What I'm trying to do is re-provision data every time my feature is activated without deleting the SPList. The idea is to use the

definition used in the List definition to provision the data and update the non-ID fields i.e. to rename it if it already exists. If possible, I'd like to do this in the FeatureActivated event, as I could traverse the XML defined in my Elements.xml file.


In your C# code you could use the SPUtility.GetGenericSetupPath with the 14 HIVE relative path to the file to get the full file system path of the file. Then use the full path to open the file from the file system.

SPUtility.GetGenericSetupPath(@"TEMPLATE\FEATURES\") would return c:\program files\common files\web server extensions\14\template\features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy