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.

Published by Mohit Vashishtha

Having extensive experience in software industry as a Team Lead and SharePoint consultant. I have worked with various MS technologies like SharePoint, .Net, AngularJS and Angular 6. I love to learn and share new things which I learn during my experience.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: