Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm working on a (non-visual) Web Part and wish to read from an xml file placed in the "C:\inetpub\wwwroot\wss\VirtualDirectories\80\wpresources" folder:

Code-Behind:

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

Can someone help me with the correct syntax for the Feature.xml to include this XML file when deploying the Feature?

UPDATE 10-08-2012:

Tried adding links.xml to same location as the Web Part and got following error:

Error occurred in deployment step 'Add Solution': Error: Cannot find this file specified in the manifest file: SecureLinksWP_Feature1\SecureLinks\links.xml

Elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
  <Module Name="SecureLinks" List="113" Url="_catalogs/wp">
    <File Path="SecureLinks\SecureLinks.webpart" Url="SecureLinks.webpart"
      Type="GhostableInLibrary">
      <Property Name="Group" Value="Custom" />
    </File>
    <File Path="SecureLinks\links.xml" Url="SecureLinks/links.xml"
      Type="GhostableInLibrary" />
  </Module>
</Elements>

Feature1.Template.xml:

<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="4BB4B62C-4F2F-4BB5-A477-DF783B802DD5" 
         Title="SecureLinksWP"
         Scope="Site"
         Version="1.0.0.0"
         Hidden="FALSE"
         DefaultResourceFile="core"
         xmlns="http://schemas.microsoft.com/sharepoint/">

    <ElementManifests>
        <ElementManifest Location="SecureLinks\Elements.xml" />
        <ElementFile Location="SecureLinks\SecureLinks.webpart" />
        <ElementFile Location="SecureLinks\links.xml" />
    </ElementManifests>
</Feature>
share|improve this question
1  
why don't add this file to your feature code and deploy it as a solution if its only going to be used by feature ? –  SharePointer Oct 2 '12 at 21:56
    
Could you give me the syntax for that in an answer, URL, PATH, etc? I had difficulty configuring it like this... –  IrishChieftain Oct 2 '12 at 21:58
    
@yaron, updating question –  IrishChieftain Oct 2 '12 at 22:16
    
code you entered is for "element.xml" not feature.xml –  SharePointer Oct 2 '12 at 22:26
    
Fixed that, thanks :-) –  IrishChieftain Oct 2 '12 at 22:27
add comment

1 Answer 1

up vote 1 down vote accepted

You can try WSP builder to develop a solution file and include this xml file within your solution but that will be case only if this file is there to be used by this feature only.

you can download and install it from link below, and its a Visual studio extension

http://wspbuilder.codeplex.com/

hope it helps :)

Edit

Copy that file to your feature folder and add this line to your code

<ElementManifest Location="links.xml" />

so it will be something like this

<Feature 
Title="Title" 
Description="sssss" 
Id="ID" 
Scope="Site" 
Version="1.0.0.0" 
xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="links.xml" />
  </ElementManifests>
</Feature>

EDIT 2

Try this

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
  <Module Name="SecureLinks" List="113" Url="_catalogs/wp">
    <File Path="SecureLinks\SecureLinks.webpart" Url="SecureLinks.webpart"
      Type="GhostableInLibrary">
      <Property Name="Group" Value="Custom" />
    </File>
    <File Path="SecureLinks\links.xml" Url="links.xml"
      Type="GhostableInLibrary" />
//not sure why you don't have property name here ?
      </Module>
</Elements>
share|improve this answer
    
Maybe I should put the links.xml file in its own module because the module URL is different for the Web Part? –  IrishChieftain Oct 2 '12 at 22:32
    
I think you should match your code with one in this link msdn.microsoft.com/en-us/library/dd586611(v=office.11).aspx –  SharePointer Oct 2 '12 at 22:34
    
They are defining path in Module tag and then just providing URL to file, I would help you more but I have to go now, hope your problem get solved :) –  SharePointer Oct 2 '12 at 22:36
    
Thanks for your help yaron, will give this a shot :-) –  IrishChieftain Oct 2 '12 at 22:37
    
Still getting the error above... –  IrishChieftain Oct 3 '12 at 14:38
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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