Tuesday 10 January 2012

3 Ways to Save SharePoint 2010 Publishing Sites as a Template

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!

15 comments:

  1. You can also use SharePoint Designer to save a subsite as a template.

    ReplyDelete
  2. I create a site with pages set up with content queries and subsites. I would like to save the whole site as a template, so we can push this out to other sites. Have you done something like this?

    ReplyDelete
  3. Also, I want to push the whole package with master pages, css files, Item styles, and templates as a feature you activate in the site.

    ReplyDelete
  4. Hi Edward, Yeah - I recommend a more structured approach using a custom web template in Visual Studio http://msdn.microsoft.com/en-us/library/ff408263(v=office.14).aspx

    ReplyDelete
  5. But after creating the new site using saved sit template , site is not opening, giving error as "HTTP 404 Not found"

    ReplyDelete
    Replies
    1. Hi Parveen, this is because your home page is not set on the new site you created based on templte. just append _layouts/settings.aspx to the URL and navigate to the settings and set the default home page fro the site.

      Delete
  6. http://camaragenbandarq.blogspot.com/2017/05/membahas-macam-macam-judi-di-indonesia.html
    http://agenbandarqcamarqq.blogspot.com/2017/05/mengetahui-4-tempat-judi-termewah-di.html
    http://agendomino99camarqq.blogspot.com/2017/06/trik-curang-main-bandarq.html
    http://agendominocamar.blogspot.com/2017/06/mengetahui-warnet-di-jepang-yang.html
    http://agendominocamarqq.blogspot.com/2017/06/cara-mendaftar-di-shioqq-situs-agen.html
    http://www.jakartatercinta.com/2017/05/mengenal-situs-shioqq-agen-bandarq.html
    http://www.jakartatercinta.com/2017/05/shioqqnet-agen-bandarq-yang-memberi.html

    ReplyDelete
  7. Wonderful bloggers like yourself who would positively reply encouraged me to be more open and engaging in commenting.So know it's helpful.
    Sharepoint Training in Chennai

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. Hi, thank you very much for new information , i learned something new. Very well written. It was so good to read and usefull to improve knowledge. Keep posting. If you are looking for any python related information please visit our website
    python training in pune.

    ReplyDelete
  11. Really very happy to say, your post is very interesting to read. I never stop myself to say something about it. You’re doing a great job. Keep it up…

    Get Business Objects Training in Bangalore from Real Time Industry Experts with 100% Placement Assistance in MNC Companies. Book your Free Demo with Softgen Infotech.

    ReplyDelete