Below are four ways to set another page as your home page: (all four work for both 2007 and 2010)
(that was easy!)
2007:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.welcomepage.aspx
For SharePoint 2007 (the first two lines are different):
- From Site Settings (If the publishing features are enabled)
- From SharePoint Designer
- From code / API
- From PowerShell
Important note for all four methods:
Make sure all of your users have at least read access to the new home page, and if in a library that you have it checked in and published.If the publishing features are enabled for a site then:
Site Actions, Site Settings, Welcome Page(that was easy!)
2007:
2010:![]()
From SharePoint Designer:
Right-click the new page and click "Set as Home Page". (For SharePoint 2007 this only appears to work from SharePoint Designer if the file is in the root of the site. I.e. the same place as default.aspx.)Via the API:
C# and VB developers can use the SPFolder.WelcomePage property. See:http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.welcomepage.aspx
Via PowerShell:
For SharePoint 2010:$site = Get-SPSite http://yourserver/sites/yoursite $web = $site.RootWeb (or $web = $site.OpenWeb("yoursubsite") $folder = $web.RootFolder $folder.WelcomePage = "SitePages/home.aspx" (or $folder.WelcomePage = "default.aspx") (or $folder.WelcomePage = "Shared%20Documents/mycustomwebpartpage.aspx") $folder.update() $web.Dispose() $site.Dispose()
For SharePoint 2007 (the first two lines are different):
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $site = New-Object Microsoft.SharePoint.SPSite("http://yourserver/sites/yoursite") $web = $site.RootWeb (or $web = $site.OpenWeb("yoursubsite") $folder = $web.RootFolder $folder.WelcomePage = "SitePages/home.aspx" (or $folder.WelcomePage = "default.aspx") (or $folder.WelcomePage = "Shared%20Documents/mycustomwebpartpage.aspx") $folder.update() $web.Dispose() $site.Dispose()
No comments:
Post a Comment