Quantcast
Viewing all articles
Browse latest Browse all 123975

Blog Post: How to change the default home page in SharePoint 2007 or 2010

Below are four ways to set another page as your home page: (all four work for both 2007 and 2010)

  • From Site Settings (If the publishing features are enabled)
  • From SharePoint Designer
  • From code / API
  • From PowerShell

The first two can be used by Site Owners, the second two can only be used for developers and administrators.

Site Settings (if the publishing features are enabled for a site):

Site Actions, Site Settings, Welcome Page

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.)

API:

C# and VB developers can use the SPFolder.WelcomePage property. See: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.welcomepage.aspx

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()


Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 123975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>