Sunday, July 12, 2009

Setting the navigation options for a meeting workspace

This is just wierd. I had to change the navigation options for a meeting workspace using code on a MOSS farm. The meeting workspaces were all under a publishing site, with the publishing feature turned on, so the option to inherit the navigation from the parent site is available in the UI.
However, there is no option to set it in the API.
When dealing with publishing sites, you can easily set it by using the PublishingWeb object instead of the SPWeb object - but using PublishingWeb.IsPublishingWeb on the event workspace returns false.
So I had a look at the code that runs when you click OK on the navigation settings page - and guess what? Microsoft doesnt check if the site is a publishing web or not - they just assume it is, and set the properties! So I did the same, and the code runs great. It doesnt matter that it is not a publishing web.
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web); pubWeb.InheritGlobalNavigation = true;

No comments: