Go to SharePoint-set the site's default welcome page

Source: Internet
Author: User

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 /.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.