locked
Possible ways to create Sites (Out of a Web Definition) RRS feed

  • Question

  • Hello Everybody,

    just another newbie question. Well, i have a Web Definition. If someone creates a Site out of this Web Definition, i want that this Definition also creates a couple of SubSites. Which possible ways exists and which one should i prefer?

    btw. my only known solution is to create a Feature with a Feature Reciever, which creates the Site. This Feature is listed in the WebFeatures Part of the Web Definition onet.xml

    Thanks for your response,

    My best regards

    THO

    Tuesday, July 2, 2013 3:50 PM

Answers

  • Hi THO,

    I believe that's the only way to do it. I don't know of a way within a Site Definition to declaratively create sub sites.

    So you would create a feature that attaches to the Web Provisioned Event: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spwebeventreceiver.webprovisioned.aspx

    This feature would just need to be activated at the site collection level if your Site Definition. The feature would take care of setting up the sub sites.


    Shereen Qumsieh http://sharepointdeveloperhq.com @msshushu

    • Proposed as answer by Brandon Atkinson Tuesday, July 2, 2013 6:34 PM
    • Marked as answer by Entan Ming Thursday, July 11, 2013 6:00 AM
    Tuesday, July 2, 2013 5:46 PM

All replies

  • Hi THO,

    I believe that's the only way to do it. I don't know of a way within a Site Definition to declaratively create sub sites.

    So you would create a feature that attaches to the Web Provisioned Event: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spwebeventreceiver.webprovisioned.aspx

    This feature would just need to be activated at the site collection level if your Site Definition. The feature would take care of setting up the sub sites.


    Shereen Qumsieh http://sharepointdeveloperhq.com @msshushu

    • Proposed as answer by Brandon Atkinson Tuesday, July 2, 2013 6:34 PM
    • Marked as answer by Entan Ming Thursday, July 11, 2013 6:00 AM
    Tuesday, July 2, 2013 5:46 PM
  • Hi THO,

    I believe that's the only way to do it. I don't know of a way within a Site Definition to declaratively create sub sites.

    So you would create a feature that attaches to the Web Provisioned Event: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spwebeventreceiver.webprovisioned.aspx

    This feature would just need to be activated at the site collection level if your Site Definition. The feature would take care of setting up the sub sites.


    Shereen Qumsieh http://sharepointdeveloperhq.com @msshushu


    Yes this, or if you have a custom feature that is activated in the onet.xml, you can create your subsites there ;)
    Thursday, July 4, 2013 3:59 PM