Delen via


How to set SPFolder.WelcomePage property?

Some SharePoint objects needs an instance to work perfectly, one example is here;

Sample 2 works however the Sample 1 doesn't :)

Sample1

SPSite site = new SPSite("https://server:100/sites/InternetSite/");

SPWeb web = site.OpenWeb();

web.RootFolder.WelcomePage=”TestWiki/Hello.aspx”;

web.RootFolder.Update();

Sample 2

SPSite site = new SPSite("https://server:100/sites/InternetSite/");

SPWeb web = site.OpenWeb();

SPFolder folder = web.RootFolder;

folder.WelcomePage = "TestWiki/Hello1.aspx";

folder.Update();