Recently I have found that you could actually provision Publishing Pages using the declarative markup of Features. Right after that discovery I have found that you could benefit of that functionality in quite a few scenario’s, like provisioning test content wrapped in Features. The biggest downside against provisioning Publishing Pages would be having to generate the XML manually. To simplify the process I have decided to create a tool which would export the existing Publishing Pages to Feature XML. Guess what: the tool is ready now and you can take a test drive.
Introducing Imtech OCD Export Page
Imtech OCD Export Page is a tool that simplifies the process of provisioning Publishing Pages by extracting existing pages to XML. All you have to do is to create some Publishing Pages, run Imtech OCD Export Page and it will generate all the files that you need to wrap your Publishing Pages in a Feature.
Imtech OCD Export Page v220.127.116.11 ships as a custom STSADM command (ocdexportpage) which becomes available upon deployment of the Solution. To export the existing Publishing Pages all you have to do is to provide the URL, eg:
stsadm -o ocdexportpage -url http://adventureworks.com -path C:\AW
URL can point either to a Publishing Site Collection, Publishing Site or a single Publishing Page. Path points to a directory on your file system where the generated files are being saved. Because Imtech OCD Export Page generates multiple files you have to point to a directory instead to a single file.
Running the above command will generate the Elements.xml file with all Publishing Pages existing at the given URL.
Because you need more than Elements.xml only to get the Publishing Pages provisioned to SharePoint, Imtech OCD Export Page v18.104.22.168 provides you with two more parameters.
Automatically generating Feature.xml
Elements.xml is a Feature Manifest meant to be called from within a Feature. In order to provision the Publishing Pages stored in Elements.xml you would have to create a Feature.xml file with the Feature definition. Imtech OCD Export Page v22.214.171.124 automates that task and is able to generate the Feature.xml file for you. All you have to do is to add the CreateFeatureXml parameter to the STSADM command:
stsadm -o ocdexportpage -url http://adventureworks.com -path C:\AW -CreateFeatureXml
Calling the above command will make Imtech OCD Export Page create two files: Elements.xml with the contents of the exported Publishing Pages and Feature.xml with the Feature definition.
By default the generated Feature points to a Feature Receiver which on Feature Deactivation removes all Publishing Pages which were provisioned by the Feature. This Feature Receiver is a part of Imtech OCD Export Page and is stored in the same assembly as the STSADM command. You will need this assembly installed on every machine on which you will want to provision the exported Publishing Pages.
If you however don’t want to use the Feature Receiver in your Feature, you can modify the generated Feature.xml file and remove the ReceiverAssembly and ReceiverClass attributes from the Feature element.
Generating Template Page
While I was researching the functionality of provisioning Publishing Pages using Features declarative markup I mentioned that you need a Template Page in order to provision an instance of a Publishing Page. Because it’s not likely that you have it included in your project, Imtech OCD Export Page allows you to generate the Template Page by adding an extra command line parameter - CreateTemplatePage:
stsadm -o ocdexportpage -url http://adventureworks.com -path C:\AW -CreateTemplatePage
Running the above command will result in creating two files in the C:\AW directory: Elements.xml with the contents of the exported Publishing Pages and TemplatePage.aspx.
You can of course use both CreateTemplatePage and CreateFeatureXml parameters in one command call to generate a fully working Feature provisioning your Publishing Pages.
Imtech OCD Export Page v126.96.36.199 is the very first version of this tool. I’m really curious about what you think of it and what your experience is. Please don’t hesitate to send my any feedback or ideas you might have.
I have also some ideas of my own I’m going to work on in the coming weeks.
Export to XML button on the Page Editing Toolbar
You’ve probably noticed this one on the screenshot I posted with the research article. Imagine that you would be able to export the content and configuration of any page using the SharePoint Web UI. From what I’ve heard from the SharePoint community it would make Imtech OCD Export Page even more useful for consultants in particular. They would be able to prototype some pages and then hand over the exported content to the developers. Additionally they could create some test content together with the customer and then include that in the project as well to support a repeatable test process.
Exporting Publishing Pages from this and all children sites
Right now Imtech OCD Export Page is able to export Publishing Pages from a single site only. If you would like to export Publishing Pages from multiple sites you would have to call the STSADM command several times passing different URL’s and output paths. Of course that it could be scripted but wouldn’t it be easier to just point to one URL and get it all done with one single command?
Generating Content Type binding information
Prior to provisioning Publishing Pages using Feature XML you should ensure that the Content Types used by these pages are bound to the Pages Library. In this version of Imtech OCD Export Page you have to take care of it by yourself. Wouldn’t it be better if the tool did it for you automatically discovering all the different Content Types used by the Publishing Pages and then generate the XML needed to bind them to the Pages Library?
These are some of the features I will be working on for the next releases of Imtech OCD Export Page. If you have any other ideas or suggestions or know of something you would really love to see in the next release, don’t hesitate to let me know. In the meanwhile try Imtech OCD Export Page out and let me know what you think of it.
Imtech OCD Export Page v188.8.131.52 is a free product and you can use it without any restrictions.
Download: Imtech OCD Export Page v184.108.40.206 (144KB, ZIP)