Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Great! Thanks Andy –  Wim Hill Apr 7 '11 at 11:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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