Wednesday, 7 September 2011

Hide or Disable the Sharepoint Quick Launch bar with a Feature

First of all I have to clarify that this is an excersice to hide/disable the quick launch bar in Sharepoint 2010 with a feature. I am not going to do a “Step by Step” tutorial because I assume you can create a feature with Visual Studio 2010 and then add the code in the Feature Receiver. Remember you just need to do a right click in the feature to add the event receiver.

public override void FeatureActivated(SPFeatureReceiverProperties properties)
    using (SPWeb _spwWeb = properties.Feature.Parent)
        _spwWeb.AllowUnsafeUpdates = true;
        _spwWeb.QuickLaunchEnabled = false;

As you can see I have encapsulated the operation inside the FeatureActivated event. We have used the QuickLaunchEnabled property inside the SPWeb object to hide/disable the bar. The process is pretty simple and can create a really nice user interface for Document Management Systems as it can show the whole page without modifying anything.

No comments: