1

I want to define a site structure :

  • Root Site

    • Subsite A

      • Subsite A.1
    • Subsite B

      • Subsite B.1
      • Subsite B.2

How to save it as a template to reuse it later ?
I tried the save as template feature but it doesn't include the subsites.

1 Answer 1

1

Not possible using template. You need to do it programmatically, there are many alternatives depending on who is creating the sites, such as:

  1. implement custom SPWeb scoped Feature that you activate on parent site and it will create the site hierarchy (it can be activated by parent site owners from Site Settings -> Site Features)
  2. JSOM code that creates the subsites. Trigger JSOM code from a button on the site. Use this if you prefer using client side object model and don't want to create custom Feature using Visual Studio. (you can place the button pretty much anywhere, but whoever clicks on it needs to have owner permission on the parent site below which subsites are created). Example here.
  3. PowerShell script to create the hierarchy (for admins only who have access to server)
4
  • Can you please add more details ? These are 3 different possible solutions ? Can you please clarify ... which custom feature are you talking about ? ...
    – Mehdi
    Nov 28, 2014 at 11:08
  • 1
    Added more detail.
    – Jussi Palo
    Nov 28, 2014 at 11:13
  • Thanks. For the first solution, i can't find the SPWeb Feature. I want to avoid the third because it is not user friendly ... The second intersed me, can you please add an example, more details ...
    – Mehdi
    Nov 28, 2014 at 11:18
  • Added link to sample code to 2.
    – Jussi Palo
    Nov 28, 2014 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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