To change the welcome page in SharePoint, you can follow these steps:
Navigate to your SharePoint site as a site administrator
Click on the gear icon in the top-right corner to access the Site Settings
In the Site Settings page, under the "Look and Feel" section, click on "Welcome page" or "Welcome page under "Look and Feel" or directly browse the below URL, https://Sharepoint-site-URL/_layouts/AreaWelcomePage.asp
On the Welcome Page settings page, select the desired welcome page from the list of available pages or specify a custom URL
Click "OK" or "Save" to apply the changes
By default, SharePoint uses the "Home.aspx" page as the welcome page. However, you can select any other page within your site or even specify a custom URL to set as the welcome page.
Note that you need to have sufficient permissions as a site administrator or owner to access and modify the site settings.
Change SharePoint Welcome Page using PowerShell
To set the welcome page in SharePoint using PowerShell, you can use the following code:
$SiteUrl = "https://sharepoint.com"
$Site = Get-SPWeb -Identity $SiteUrl
$RootFolder = $Site.RootFolder
$RootFolder.WelcomePage = "SitePages/HomePage.aspx"
$RootFolder.Update()
$Site.Dispose()
This code assumes that you have the SharePoint PowerShell module installed and have appropriate administrative privileges.
Here's a breakdown of what the code does:
1. Set the variable `$SiteUrl` to the URL of your SharePoint site.
2. Use the `Get-SPWeb` cmdlet to retrieve the SharePoint site object based on the given URL.
3. Get the root folder of the site using `$Site.RootFolder`.
4. Set the `WelcomePage` property of the root folder to the desired welcome page URL (e.g., "SitePages/HomePage.aspx").
5. Update the root folder to save the changes using `$RootFolder.Update()`.
6. Dispose of the SharePoint site object using `$Site.Dispose()` to release the resources.
By executing this PowerShell script, you can programmatically set the welcome page for your SharePoint site without modifying the provided code.
Yorumlar