Using C# :-
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using
(SPWeb web = site.RootWeb)
{
web.AllowUnsafeUpdates = true;
SPFolder
rootFolder = web.RootFolder;
rootFolder.WelcomePage = "SitePages/pageName.aspx";
rootFolder.Update();
}
}
Using Power Shell :-
$SiteUrl = "http://abcd-pc:12121/sites/Samples/"
Site = Get-SPWeb -identity
$SiteUrl
$RootFolder = $Site.RootFolder;
$RootFolder.WelcomePage =
"SitePages/pageName.aspx";
$RootFolder.Update();
$Site.Dispose()
No comments:
Post a Comment