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

This is probably a very basic question to many, but my background is as a SharePoint developer. I have done very little with wiki pages, or site pages in general.

I am creating a SharePoint 2010 site for a small team in our organization, and we have selected to use the Team Site template. I spent some time adding web parts, images and text to the home page (SitesPages/Home.aspx) as a means of visualizing what we could do with the site. This was all done in my development environment.

Now that we are happy with the development version of the page, is there some way to export it and add it to our Visual Studio project so that it can eventually be re-deployed to production? Is this even a good approach, or should we just expect to recreate the page manually in production?

My first thought was that we could export the page from SPD and deploy it via a module feature, but I have since learned that the EmbeddedFormField control in the wiki page makes that impossible.

I have also tried this approach: http://www.sharemuch.com/2012/02/20/how-to-automatically-provision-sharepoint-2010-wiki-pages-content/. The resulting page does not properly render the web parts (the web parts are not there, just some text). I also get "The current page has been customized from its template. Revert to template" message and can't make it go away, even if I click "Revert to template".

My module looks like this:

<Module Name="OneCallPages" Url="SitePages" SetupPath="FEATURES\MyProject.SharePoint_SiteAssetsFeature\MyProjectAssets\SitePages" List="119">
  <File Path="Welcome.aspx" Url="Welcome.aspx" Type="GhostableInLibrary">
    <Property
      Name="WikiField"
      Type="string"
      Value="..."/>
   </File>
</Module>
share|improve this question

2 Answers 2

Have you tried saving the site as a template and exporting the .wsp? Then you can upload the .wsp to the solutions catalog on the target environment and use it as a site template to deploy the page layout.

To save the site as a template go to Site Settings > Save site as template. Easy as that.

The .wsp will be stored in the solutions catalog which can be navigated to at:

http://[path to site collection]/_catalogs/solutions/

Step by step instructions can be found here.

share|improve this answer
    
If that's the best approach, then we can do it. My initial reaction was to have something in Visual Studio that could be version controlled, but it's sounding like that's not a common practice? –  jason.venema Jul 25 '12 at 14:49
1  
When I've created pages programmatically for deployment in the past, I've built them programmatically from the beginning. Once you have a page already built it's a lot more work to go back and recreate what you've already built out manually. I've done it both ways. Actually, once you have your template .wsp you can import that into Visual Studio if you want to actually see the code behind it, or to add/remove code, or to add it to source control, etc. Here's a link: msdn.microsoft.com/en-us/library/ee231603.aspx –  RJ Cuthbertson Jul 25 '12 at 15:00
    
I've tried importing the template .wsp into Visual Studio too, but it always causes VS to crash. Any idea what that's all about? Also, is it difficult to maintain pages that you create programmatically? –  jason.venema Jul 25 '12 at 15:14
    
The difficulty lies in the fact that every time a change is made to the page, you would also need to go back and change the code, rebuild it, and upload the .wsp again to the solutions catalog. Less code is always better than more code (and believe me, I love code). –  RJ Cuthbertson Jul 25 '12 at 15:20
    
Also, nice to see another Michigander on here. –  RJ Cuthbertson Jul 25 '12 at 15:22
up vote 1 down vote accepted

Many thanks to rjcup3 for the help. I ended up using the approach described here: http://sharepointstruggle.blogspot.com/2011/10/programmatically-provisioning-wiki.html.

Basically, it involves creating an XML file with the contents of the wiki page, and then exporting each of the web parts on the page from SPD and referencing the resulting .webpart (.dwp) file contents from the XML. Then a custom class takes care of creating the wiki page programmatically, and importing the web parts.

share|improve this answer

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.