Tip #7. Changing default layout page after Site Collection was created

Rate this item
(0 votes)
SharePoint doesn’t provide you Administrative functionality to change the default layout page after you created Site Collection. This maybe an issue, for the SharePoint hosting, when you create site once, but need to change your your welcome page after.

So, the only way to do this is via SharePoint API – Feature Receiver. Use the following code-snippet to do this:

   1: public overridevoid FeatureActivated(SPFeatureReceiverProperties properties)
   2: {
   3:     SPWeb site = (SPWeb)properties.Feature.Parent;
   4:     SPFolder folder = site.RootFolder;
   5:     folder.WelcomePage = "Wiki Pages/How To Use This Wiki Site.aspx";
   6:     folder.Update();
   7: }

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.