When must we create site pages through visual studio?
-
30-09-2020 - |
Question
Generally site pages are created through SP designer. But what are business requirement when we MUST create site pages through visual studio rather than designer?
Solution
One requirement can be that client wants a Custom Site Template (like Team Site etc.) and the template will include few landing pages etc.
We can use SPWebProvisioningProvider class to activate features, add lists, pages etc.
For provisioning pages on List Creation, you can use ListAdded event receiver as shown in List Event Receiver in SharePoint 2010
For provisioning pages when a subsite is created, you can use WebProvisioned event receiver as shown in WebProvisioned Event receiver - a Practical Example
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange