Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
For those of you looking to dynamically change the Welcome page for a MOSS Publishing site dynamically here you go:
Where "p" is the URL for the page you would like to change the welcome page to (i.e. "Pages/Home.aspx").
static public void UpdateWelcomePage(SPWeb web, string p)
{
if (PublishingWeb.IsPublishingWeb(web))
{
PublishingWeb pw = PublishingWeb.GetPublishingWeb(web);
PublishingSite site = new PublishingSite(web.Site);
//Set the default page
SPFile welcomefile = web.GetFile(p);
pw.DefaultPage = welcomefile;
pw.Update();
}
}
Note the SPWeb.GetFile() method also has an overload for the GUID of the page you would like to make the Welcome Page.
Comments
- Anonymous
July 24, 2008
PingBack from http://wordnew.acne-reveiw.info/?p=12488