Thursday, July 30, 2009

Audience Targeting for Quick Launch using CEWP in SharePoint

I have seen this query in communities to hide the Quick Launch for a user group / particular audience. Most of the SharePoint developers know that Content Editor Web Part can be used to hide the Quick Launch bar.

To achieve the same, add the CEWP to the page, where you do not want to display the Quick Launch. Open Source Editor of CEWP and add the following

display: none;

Once the above <style> has been added, go to Advance Setting, set “Audience Targeting”. Set the group/audience to which you do not want to display the Quick Launch bar.

I have set the “Visitors” group in Audience Targeting. This setting will not allow the “Visitors” to see the Quick Launch bar.

I have a moss_user1 in Visitors Group and moss_user2 in Members Group.

The below screen hides the Quick Launch for moss_user1 (Visitors Group)

See the following screen, which shows the Quick Launch for moss_user2 (Members Group)

This approach will work for a single page, if you want the same to apply for all pages then add the CEWP to the master page with the above specified settings.

SharePoint Custom Search using FullTextSqlQuery – Format Hit Highlighted Summary

SharePoint search uses “HitHighlightedSummary “column for highlighting the search text in result summary. Querying the HitHighlightedSummary column using FullTextSqlQuery returns the data that contains hit highlights that are surrounded with tags like <c0>…</c0>

This hit-highlight can be easily customized in OOB search core result web part by customizing the xsl. If it is a custom web part and using FullTextSqlQuery then we need to write piece of code to format hit-highlights.

public static string FormatHitHighlightedSummary(object text, string highlightedTag)
return Regex.Replace(Regex.Replace(text.ToString(), @"<c\d>", string.Format("<{0}>", highlightedTag), RegexOptions.IgnoreCase), @"</c\d>", string.Format("</{0}>", highlightedTag), RegexOptions.IgnoreCase);

While binding the Highlighted Summary, use the above created method as shown below
<%# FormatHitHighlightedSummary(Eval("HitHighlightedSummary"), "i")%>

I’ve used “Italics - <i>” to Highlight the search text… Use this method to format highlighted summary depends on your requirement.

Wednesday, July 29, 2009

SharePoint Custom Page Layout – Web Parts getting added twice

I have used SharePoint Designer to create a custom page layout and added few custom web parts (drag-drop using SPD).

The Page Layout has been deployed using a Feature. After deployment, The Page Layout has web parts as expected and the issue is, when a page is created using the custom Page Layout, each web part is added twice.

I have tried different approaches to remove the web parts unsuccessfully. Finally removed all web parts (which I have added using SharePoint Designer) and used “
AllUsersWebPart” element to add custom web parts in Feature. It worked like a charm!

Monday, July 27, 2009

Useful Tools for SharePoint

The following are the tools which are very frequently used in SharePoint Projects.

SharePoint Designer

SharePoint Designer is a WYSIWYG HTML editor and web design application from Microsoft exclusively for SharePoint sites.

Download link:

U2U CAML Builder

A tool for creating and executing CAML queries

Download link:

SP Dispose Check

A tool for writing safe code using SharePoint Object Model to prevent memory leaks

Download link:


A tool for creating SharePoint Solution Package (WSP) WSS 3.0 & MOSS 2007

Download link:


A tool for creating easy deployable solution

Download link:

SharePoint Manager 2007

It a SharePoint object model explorer tool, enables you to browse every site on the local farm and view every property.

Download link:

WSS/MOSS Log file reader

A tool to View, search and filter SharePoint ULS log files directly from within Central Administration.

Download link:

SharePoint Logging Spy

A tool to allow real time diagnostics of multiple servers in a SharePoint

Download link:

SharePoint Test Data Population Tool

A tool for capacity planning and performance testing that populates data for testing SharePoint deployments

Download link:

AD Explorer

It is an advanced Active Directory (AD) viewer and editor which allows manipulation of AD objects

Download link:

IE Developer Toolbar

A tool that aims to aid in design and debugging of web pages

Download link:

Note: “Internet Explorer 8” includes the features of IE Developer Toolbar built in, instead of a separate product; known as Developer Tools rather than Developer Toolbar.


A tool for disassemble Assemblies

Download link:


A tool that helps developers writing XML documentation comments

Download link:

Resource Refactoring

A tool to extract hard coded strings from the code to resource files

Download link:


It is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet.

Download link: