R – Use an XML File with a Feature

sharepoint

Currently I have a custom Web Part, deployed as a Feature, and it accesses an XML file as follows:

string sUri = @"C:\inetpub\wwwroot\wss\VirtualDirectories\80" + @"\wpresources\links.xml";

ds = new DataSet();
ds.ReadXml(sUri);

What is the correct way to include an XML file as part of a SharePoint Feature deployment?

Best Answer

Load it into the 12 hive under your layouts directory and link to it via

http://[currentsite]/[currentweb]/_layouts/links.xml

. Or add a subdirectory to group all of your file together. e.g.

http://[currentsite]/[currentweb]/[myFeature]/_layouts/links.xml

how do I include it in the Feature project...?

I am using STSDEV and that automagically puts an entry into the manifest.xml under

<Templates> 

e.g.

<TemplateFile Location="LAYOUTS\[myFeature]\links.xml" />