Friday, January 13, 2012

Hide the Quick Launch in SharePoint 2010

If you like a welcome page of portal or selected pages without Quick Launch and the Tree View navigation then the easiest way is to implement the solution is to use the content editor web.

This solution is called micro solution which do not need code and uses content editor to insert style code embeded on the pages. Follow steps below to implement solution.

Step 1. Open Page in edit mode where you do not need Quick Launch Menu

Step 2. Click on "Insert" --> Web Part to insert new web part on the page and select Content Editor web Part from "Media and Content" category on the page

Step 3. Add following text in the HTML Source mode

<style>
/*--Hide Quick Launch --*/
 #s4-leftpanel{
 display:none
 }
 .s4-ca{
 margin-left:0px
 }
</style>

Step 4. Save Changes and Browse the page.

Thursday, January 12, 2012

Remove Site Actions Menu for users

Remove “Site Actions” for users based on their permissions
Step 1: Open the master page attached for your site into SharePoint Designer 2010/Visual Studio or Notepad

Step 2: Search for "<SharePoint:SiteActions" Text

Step 3: Now, Just before <SharePoint:SiteActions>.. Add following line

<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="ManageSubwebs">

Step 4: Last, find "</SharePoint:SiteActions" Text and add following line after that
</SharePoint:SPSecurityTrimmedControl>

So, Your updated code will read somewhat as below:

<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="ManageSubwebs">
<<SharePoint:SiteActions control text>>
</SharePoint:SPSecurityTrimmedControl>

Explaination....SharePoint:SPSecurityTrimmedControl tag checks the SharePoint permission for user and then it enables content (if allowed). There are many predefined permission strings documented at MSDN (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx) and you can mention more than one in same declaration delimited by comma.

Hope you liked the trick.