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("http://server");

SPWeb web = site.OpenWeb();

web.RootFolder.WelcomePage=”default1.aspx”;

web.RootFolder.Update();

Sample 2

SPSite site = new SPSite("http://server");

SPWeb web = site.OpenWeb();

SPFolder folder = web.RootFolder;

folder.WelcomePage = "default1.aspx";

folder.Update();

LEAVE A REPLY

Please enter your comment!
Please enter your name here