Goto Site Actions-->Site Settings-->Look and Feel --->Welcome page
Change the Page url ...
All set now you are able to see the site page as home page of your site .
Change the Page url ...
All set now you are able to see the site page as home page of your site .
- Programatically......Changing the Welcome Page
public static void ChangeWelcomePage(SPWeb rootWeb, string pageName) { if (PublishingWeb.IsPublishingWeb(rootWeb)) { PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(rootWeb); //Get the file name SPFile welcomeFile = rootWeb.GetFile(pageName); //Assign the new filename to the DefaultPage property pubWeb.DefaultPage = welcomeFile; //Update the Publishing Web. pubWeb.Update(); } }
Power Shell .
Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
################################################### code###################################################$sourceWeb = $null try { $SiteUrl = "http://adigroup/myteamsite" $sourceWeb = Get-SPSite -identity $SiteUrl $oFolder = $sourceWeb.RootFolder; $oFolder.WelcomePage = "Pages/MyCustomPage.aspx"; $oFolder.Update();} catch { write-host $_.exception} finally { if($sourceWeb -ne $null){$sourceWeb.Dispose()}}
No comments :
Post a Comment