-
-
Save javierguerrero/a7493563464a940a12a4 to your computer and use it in GitHub Desktop.
Changing the SharePoint Welcome Page Programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClientContext context = new ClientContext(webUrl); | |
Web web = context.Web; | |
context.ExecuteQuery(); | |
Folder folder = web.RootFolder; | |
context.Load(folder); | |
folder.WelcomePage = "SitePages/MyCustomPage.aspx"; | |
folder.Update(); | |
context.ExecuteQuery(); | |
//For other folder (e. g. Site Pages) | |
ClientContext context = new ClientContext(webUrl); | |
Web web = context.Web; | |
context.ExecuteQuery(); | |
List rootFolder = web.Lists.GetByTitle("Site Pages"); | |
context.Load(rootFolder); | |
rootFolder.RootFolder.WelcomePage = "Forms/AllPages.aspx";//"MyCustomPage.aspx"; | |
rootFolder.Update(); | |
context.ExecuteQuery(); | |
Fuente: http://mypowershell.webnode.sk/news/set-site-collection-welcome-page-by-client-object-model/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment