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 having some difficulty creating a Feature which contains a Web Part and a links.xml which is processed by the WP code-behind. My difficulty is in understanding the Feature XML config files and incorporating the links.xml file in the Feature:

(1) There is a Feature folder with an xml file called Feature1.Template.xml. Is is standard practice to rename this to something more meaningful?

(2) The Elements manifest file has some entries that I cannot find meaningful documentation for; for example the "property" element:

http://msdn.microsoft.com/en-us/library/ms465236.aspx

UPDATE:

I'm getting the following error: "Error occurred in deployment step 'Activate Features': Failed to instantiate file "links.xml" from module "WP_Resources": The specified list does not exist."

Can someone offer up an explanation?

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

    <ElementManifests>
        <ElementManifest Location="SecureLinks\Elements.xml" />
        <ElementFile Location="SecureLinks\SecureLinks.webpart" />

        <ElementManifest Location="WP_Resources\Elements.xml" />
        <ElementFile Location="WP_Resources\links.xml" />
    </ElementManifests>
</Feature>

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="WP_Resources" Path="WP_Resources">
        <File Path="links.xml" Url="links.xml" Type="GhostableInLibrary" />
    </Module>
</Elements>
share|improve this question
    
Part of the problem was the underscore in my module name "WP_Resources". –  IrishChieftain Oct 9 '12 at 21:46

1 Answer 1

up vote 1 down vote accepted

Answer to your question #1 - It's not advisable

Answer to your question #2 - Property is used for defining several metadata, I can give you some simple example to get a feeling of usefulness of Property, like in your example this means the group of you web part is custom, simply saying when you click on add web part, you can find your web part in the group 'Miscellaneous', you can also create your own group, give any name here and next time when you click on Add Web Part you can find a new group has been created with the custom name, and if you use that name for some other web part, that web part will list with other web part with same custom group, apart from grouping you can also specify other attributes like 'Title' for Web Part title, 'WebPartDescription' for description, just add

<Property Name="Group" Value="YourGroup" />
<Property Name="Title" Value="Your Webpart Title" />

like this.

And about the error, your xmls look like OK, did you try deleting and adding reference multiple times? you may delete the element.xml file, create an empty element and add your example file, as described here. Or if you are not too concerned about creating extra features you can also create a feature to deploy files only. But I think you should try with checking the file path first, if you have added your files in a right way and in a right structure.

share|improve this answer
    
I've put the links.xml file in its own module and am updating the markup above. Am getting different error now... –  IrishChieftain Oct 5 '12 at 21:34
    
Can you post the error here? –  Diptarag Oct 6 '12 at 7:46
    
I've updated the error text in the question above. –  IrishChieftain Oct 6 '12 at 12:19
    
"Error occurred in deployment step 'Activate Features': Failed to instantiate file "links.xml" from module "WP_Resources": The specified list does not exist." –  IrishChieftain Oct 8 '12 at 15:04
    
Do you have any list with the name "WP_Resources", when you are giving <Module Name="something" Path="a valid path"> give any document library name or if you want to deploy it to layouts folder point to it, but remember if you are going to access the xml file from any other code (web part for example) there you need to load the xml properly with the help of either relative path (in case of layouts folder deployment) or using object model code for document library (i would suggest that) –  Diptarag Oct 9 '12 at 6:33

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.