Hide Quick launch in SharePoint 2010

To hide the quick launch bar in sharepoint 2010, we can easily achieve using css class.

We can either include in page layout/in content editor webpart by adding the following css.

<style type=”text/css”>
/* hide the left menu */
display:none; /* hide the entire quick launch content */
margin-left:0px; /* move the content area to left */


CAML Query to filter items with current logged in user

In CAML Query we may need to filter records based on the current logged in user, in list view we can use the [Me] to filter, the same functionality we can achieve using CAML query

Below is the query which will return all tasks assigned to current logged in user and the task is not completed.

<FieldRef Name=’AssignedTo’></FieldRef><Value Type=’Integer’><UserID Type=’Integer’ /></Value>
<FieldRef Name=’Status’/>
<Value Type=’Text’>Completed</Value>

Stsadm.exe Object Reference not set to an instance of an object error for administrators who is deploying a solution

In SharePoint 2010, with administrators account (not the default Sharepoint System account) users getting the object reference not set to an instance of an object.

To solve the issue, we need to give shell access permission in the SQL Server for that particular user in SharePoint_config database.

Go to SQL Management Studio -> LoginĀ  using sa account/admin login -> Select Security ->expand login -> select the user (if its not there add the user and select) -> properties

Please check the below screen for the permission


I hope this may helpful for who are always using System account to deploy the solution, even if you have another account which has admin rights.

How to log SharePoint custom webpart errors into ULS folder

When we use the custom webpart and deployed to SharePoint, sometime the webpart may throw some error and administrator needs to know when and from where the error is throwing.

To log the error in SharePoint 12 hive (or SharePoint root in 2010), we need to use the following command in the catch block of the webpart/custom code.

sample code



// do something that will throw error


catch (Exception ex)


Microsoft.Office.Server.Diagnostics.PortalLog.LogString(” Error occured in Custom xyz control ” + ex.Message + ex.Source + ex.StackTrace);


To compile the webpart/custom code we need to include the reference assembly Microsoft.Office.Server.dll from ISAPI Folder from Sharepoint 12 hive (or Sharepoint root).

Now compile the code and deploy and when the code throws some error we can check the ULS log to get the details about the error.