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 have created a module that creates a site page inside a pages library. Is there a way we can dynamically set Url property of the Module node in the XML file? I would like to set the Url property dynamically, so that it will allow easier deployment between environments (i.e. Dev, QA, Prod). Thinking about using a Farm Level Property, Web Config key, etc.

 <Module Name="pages" Url="pages" List="101">
share|improve this question
    
This url is relative so should not matter which environment you are deploying unless you want to deploy in different libraries in different environments.. is that the case? –  justforkix09 Feb 28 '12 at 19:35
    
yes. I need to deploy to different libraries. Is there a way to do this? Thanks for any help provided. –  obautista Feb 28 '12 at 21:07
1  
IMO cannot be done without custom coding. You need to write an feature receiver code which will read url from web.config/web/farm property and upload the file. –  justforkix09 Feb 29 '12 at 4:19
add comment

1 Answer

up vote 1 down vote accepted

Web Scoped Features with Relative Paths:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="TestDocLibrary" Url="TestDocLibrary" RootWebOnly="FALSE">
        <File Path="TestDocLibrary\doc1.doc" Type="GhostableInLibrary" Url="doc1.doc" Name="doc1.doc" />
        <File Path="TestDocLibrary\doc2.doc" Type="GhostableInLibrary" Url="doc2.doc" Name="doc2.doc" />
    </Module>
</Elements>

This puts two files in the TestDocLibrary of the web that the feature was activated on.

share|improve this answer
add comment

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.