Create Excluded (Unmanaged) Path using the SharePoint Object Model

Very nice tip by Maxim Tarassenko: Programmatically create an unmanaged path under SharePoint. The following code snippet creates an excluded (unmanaged) path using the Object Model of Sharepoint. This can be very usefull to automate the install of Son of SmartPart, because the Microsoft tools (WPPackager and SPSAdmin) are not (yet?) working with .NET 2.0 assemblies.

            SPGlobalAdmin admin = new SPGlobalAdmin();
            SPPrefixCollection collection =
                admin.VirtualServers[2].Config.Prefixes;
            collection.Add("/unmanaged", SPPrefixType.Exclusion);

Btw: subscribed!

No Comments