Manual:
Enable Feature: Office SharePoint Server Publishing in site collection and Site Feature. For example, both feature are enabled.
This Feature creates the Pages library.
If this Feature is not enabled, you will receive The following error message when setting The welcome page: The site is not valid. The 'page' document library is missing.
If the relevant Feature is not enabled, you will not be able to see the above picture, you can access it through a fixed page address. For example: http: // Mingle/sites/Lab/_ Layouts/AreaWelcomePage. aspx
Use the SharePoint object model:
using (SPSite site = new SPSite("http://sharepoint.com")) { using (SPWeb web = site.RootWeb) { SPFolder rootFolder = web.RootFolder; rootFolder.WelcomePage = "Pages/HomePage.aspx"; rootFolder.Update(); } }
Use PowerShell:
$SiteUrl = "http://sharepoint.com"$Site = Get-SPWeb -identity $SiteUrl$RootFolder = $Site.RootFolder;$RootFolder.WelcomePage = "SitePages/HomePage.aspx";$RootFolder.Update();$Site.Dispose()
Ps c: \> $ rootFolder. WelcomePage ="/Person. aspx"
Exception setting "WelcomePage": "The WelcomePage property must be a path thatis relative to the folder, and the path cannot contain two consecutive periods (..)."At line: 1 char: 13 + $ rootFolder. <WelcomePage = "/person. aspx" + CategoryInfo: InvalidOperation :( :) [], RuntimeException + FullyQualifiedErrorId: PropertyAssignmentException
Note: whether in Powershell or in C # code, you cannot use/at the beginning of the home address /.