Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Set any page as a home page programmatically in Sharepoint 2010

$
0
0

Hi techies,

In one of my event receiver i tried to set a page as home page but couldn't succeed in it.

Here is the code snippet which i tried:

SPFolder libraryFolder = newWeb.GetFolder("Page");
                SPFileCollection files = libraryFolder.Files;
                SPFile newFile = files.Add(newFilename, stream);
                libraryFolder.Update();
                stream.Close();
                libraryFolder.WelcomePage = "Home.aspx"; //custom landing page    
                libraryFolder.Update();

Anybody came across the same issue.

Please  let me know.

  

Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>