2

I have a WebTemplate using a team site as BaseTemplate, and was wondring how I could set the default page as home page instead of the home.aspx page and this during the provisioning process of the site so through a feature?

Thanks in advance!

4

Okay, to set the home page for a given site in a feature receiver should be something like:

SPWeb web = properties.Feature.Parent as SPWeb;

if( web != null ) 
{
SPFolder rootFolder = web.RootFolder; 
rootFolder.WelcomePage = "UrlToMyPage.aspx";
rootFolder.Update();
}

Use that in FeatureActivated to set the home page in a feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.