0

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">
  • 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
1

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.

Your Answer

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

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