Well first post of 2012 - last year was a fantastic year filled with all sorts of juicy SharePoint solutions. I have a few blog posts in Draft that I am looking forward to publishing about powershell, DPM and Property Bags, but for now heres a wee easy one that might save you some time!
I'm currently tasked with packaging a series of 2010 publishing sites, the challenge in doing so is not only that it's "not supported by Microsoft" but publishing makes it exceedingly difficult.
All of our sites for this particular part of the project are publishing sites and have all been pre-created on a lab. The requirement is that following the standard new-site creation practice, a fully customised publishing site (with subsites!) is deployed from site template.
To do this, I saved the top level Publishing Site as a template, imported it into Visual Studio 2010 and added the subsites etc. More about this later.
I discovered that you can't save a site as a template once publishing features are enabled. I found 3 ways of getting round this but be warned, it's not supported by MS. Infact, it's claimed that publishing sites saved as templates and redeployed won't upgrade later.
Anyways, first thing you can do is go to your site http://sharepoint.net/MyPublishingSite
you'll notice that "Save Site as Template" is missing from site actions. Here is 3 ways in which you can do this.
1. Go straight to the save template page
just add "/_layouts/savetmpl.aspx" to your url.
http://sharepoint.net/MyPublishingSite/_layouts/savetmpl.aspx
This will let you save "MyPublishingSite" as a template.
If you really want to knock SharePoint out of support (it's ok for labs or dev machines) –
2. Edit the PublishingSiteSettings.xml file in the hive.
C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\WEB SERVER EXTENSIONS\12\TEMPLATE\FEATURES\PUBLISHING
Open PublishingSiteSettings.xml in notepad.
At the bottom there’s a tag for HIDECUSTOMACTION.
Comment it out like so:
<!--<HideCustomAction Id="HideSaveAsTemplate" HideActionId=”SaveAsTemplate" GroupId="Customization" Location="Microsoft.SharePoint.SiteSettings" /> -->
Then add the custom action for saving as template:
<CustomAction Id="SaveAsTemplate" GroupId="Customization" Location="Microsoft.SharePoint.SiteSettings" Rights="AddAndCustomizePages,BrowseDirectories,ManagePermissions,ManageSubwebs,ManageWeb,UseRemoteAPIs,ViewFormPages" Sequence="60" Title="$Resources:SiteSettings_SaveAsTemplate_Title;"> <UrlAction Url="_layouts/savetmpl.aspx" /> </CustomAction>
3. Use PowerShell
$Web=Get-SPWeb http://sharepoint.net/MyPublishingSite
$Web.SaveAsTemplate(“Template Name”,”Template Title”,”Template Description”,1)
That’s it, have fun!