Category Archives: Sharepoint

Show a link to document properties in Sharepoint 2010 search result – Part 2

This is a follow up on previous post Show a link to document properties in Sharepoint 2010 search result. Here’s the full XSL copied from the Core Search Results web part:

Continue reading


How to resolve javascript error in Outlook 2010 browser

Symptoms: When using a Microsoft Office Outlook 2010 folder to display a web page in a Outlook folder you may receive a javascript error when hoovering a link in a Sharepoint site. Or using any other web page that requires javascript.

Resolution: Delete all RSS feeds from Outlook and the javascripts will work! More info

Show a link to document properties in Sharepoint 2010 search result

Using XSL transformation you can edit the apperance of the search results in Sharepoint 2010. One of the most commonly missed features of the default search result is the lack of a hyperlink to a documents properties (eg. DispForm.aspx). Such a link gives the users a chance to preview document properties before eventually opening the document with Word/Excel/Adoboe etc.

Here XSL code to add a hyperlink to the document properties, and also a link to the containing document library. It will also work for Sharepoint 2007. Paste the code into the search results web part using the XSL editor at the appropriate place.

Important. You must register metadata properties ItemID (ows_ID(text)) and Basic4 (Basic:4 (text)) and do a full crawl from Central Admin.

<div class=”srch-Title3″>
<xsl:variable name=”itemid” select=”ItemID”/>
<xsl:when test=”contentclass[. = ‘STS_ListItem_DocumentLibrary’]”>
<xsl:when test=”contains(basic4,’http’)”>
<xsl:variable name=”library” select=”substring-after(substring-after(url,basic4),’/’)” />
<xsl:variable name=”displayUrl” select=”concat(basic4, ‘/’, substring-before($library,’/’),’/Forms/DispForm.aspx?ID=’,itemid)” />
<a href=”{$displayUrl}”>
Show properties
<xsl:variable name=”DocLib” select=”substring-after(substring-after(url,sitename),’/’)” />
<xsl:variable name=”MetaDataPath” select=”concat(sitename, ‘/’, substring-before($DocLib,’/’),’Forms/DispForm.aspx?ID=’,itemid)” />
<a href=”{$MetaDataPath}”>
Show properties

<a href=”{sitename}”>
Show library

More reading: For a full walkthrough of editing search result check out this great article by Jesse Kim. SharePoint 2010: Actionable search results for documents

Edit: Here’s the full XSL:

Request for the permission of type ‘Microsoft.SharePoint.Security.SharePointPermission failed

Background: Deploying a aspx web application within a Sharepoint site. Such as C:\inetpub\wwwroot\wss\VirtualDirectories\80\CustomWeb.

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type ‘Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ failed.

Solution: Add this line to your applications web.config file, system.web section:

<trust level=”Full” originUrl=”” />


<trust level=”WSS_Medium” originUrl=”” />

Explanation: By default WSS/MOSS is configured with a security policy called WSS_Minimal.  This policy definition doesn’t grant access to the SP object model.