21. March 2007 06:57
If you need to reconfigure an entire hierarchy of SPWeb inheritance properties, for navigation, master pages, or page layouts, go ahead and try something like this recursive function I'm using to iterate through all child SPWebs and enable navigation inheritance. See my previous post if your not sure how to get your SPWeb in the first place.
private void FixRecursive( SPWeb myWeb)
foreach ( SPWeb web in myWeb.Webs)
PublishingWeb pweb = PublishingWeb .GetPublishingWeb(web);
pweb.InheritCurrentNavigation = true;
As a side note, this snippet is from a utility that does a variety of publishing related fixes/tasks which I have been working on for the past month. Hopefully I'll be able to get the utility itself up on the blog within the next few weeks.
19. March 2007 05:56
I was working on some quick utilities to address some upgrade bugs in Sharepoint 2007, and ran across some problems opening connections to a load balanced farm via the object model.
Here is a way that works, if you've got something better let me know! SPWebService myWebService = SPWebService .ContentService;
SPWebApplication myWebApp = myWebService.WebApplications[ "web app name" ];
SPSite mySite = myWebApp.Sites[BaseURL]; SPWeb myWeb = mySite.OpenWeb();
Where 'web app name' is the name of the web app as you see it in IIS. (e.g. "SPS Portal - 80")