Set Home page of sharepoint sites


Hi,

According to the client’s requirement, every site must be set as a custom home page other then “Pages/Default.aspx”. I have added a site definition using CKSDev tool and add this page using Onet.xml.

Next step is to create a feature at web level which should contains following code:

SPFolder rootFolder = properties.Web.RootFolder;
rootFolder.WelcomePage = "default.aspx";
rootFolder.Update();

This code will also work for any site template.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s