Question

Migrating from Sharepoint 2010 to 2019 (On-Prem, Classic UI) and I need to implement a solution that automatically generates pages (3 for example) when a subsite is created.

An example would be subsites and subsite pages for departments in a business:

EX: If I create a new 'Finance' subsite under my root site and set the page layout via a terminal command, the solution should automatically generate 3 pages under that subsite in addition to the /default.aspx page: a 'People' page, 'Overview' page, and 'Contact' page. Each would use a custom layout set via a terminal command.

Am I looking for site definitions? Or a module (as described here)? I've poured through Microsoft's documentation but the specifications of our implementation (2019, On-Prem, Classic UI) have made it difficult to discern the next steps.

It would also be great to automatically generate lists when subsites are created too. Would a similar process be used to accomplish both? Or are they different solutions?

I have access to Sharepoint Designer and Visual Studio. I'm familiar with Sharepoint Designer, it's purpose, and how it interacts with our Sharepoint environment. Not as familiar with Visual Studio, so I dont know what I dont know about the tool.

Any help in the right direction would be much appreciated. Thank you!

Was it helpful?

Solution

You could create event receiver in Visual Studio to achieve this.

There are two such events - WebAdding (When the site is started to create) and WebProvisioned - When the site has been created. And you can use these event recievers to add some custom code to create pages and lists.

SPWebEventReceiver.WebAdding method: https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server/ee586769(v=office.15)

SPWebEventReceiver.WebProvisioned method: https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server/ee566718(v=office.15)

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top