Thursday, March 20, 2014

How to customise SharePoint 2010 Blog Post

This article shows you how to customise SharePoint 2010 Blog Post's look on the Home page

From:

To (include Area information):

Note: Area is an additional column to the Post list.

Follow the following steps to customise the Blog Post look:

  • Copy the Blog Post layout template 'blog.xsd' from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\XSL from a SharePoint web front server and store it somewhere that is visible the Blog site.

In this example, I will create a folder called xsl under the Blog site root folder and store the xsd there. I will also rename it to BlogPost.xsl

Note:

To create the new folder, you can open the Blog Site in SharePoint Designer, click on All Files and then click on the New Folder button

To import the blogPost.xsl file, click the Import button and select the file

  • Open the BlogPost.xsd in SharePoint designer and look for the section with start with this comment

<!– BaseViewID='0′ and TemplateType='301′ is Home Page view for Blog's posts list –>

  • Find the <div> that define the layout for PostCategory and add the following text after that

<div>

<xsl:for-each select="$Fields">

<xsl:if test="@Name='Area' and not ($thisNode/@Area=")">

<!– output the Area field as "Area: " followed by the area –>

Area<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">:&amp;nbsp;</xsl:text>[<xsl:apply-templates select="$Fields[@Name='Area']" mode="PrintField"><xsl:with param name="thisNode" select="$thisNode"/></xsl:apply-templates>]

</xsl:if>

</xsl:for-each>

</div>

Note: @Name should be set to the correct field name syntax. To access the list's xml data, follow the instruction here http://vspug.com/dwise/2008/01/10/accessing-sharepoint-xml/

  • Save changes to the BlogPost.xsd file
  • Open the default.aspx in SharePoint Designer and make sure Area is included in the ListView Webpart column lists.
  • Select the Web part and click on the Add/Remove Columns button and then make sure Area is there.

  • Save changes to the default.aspx
  • Browse the default.aspx page and click on Site Actions\Edit Page

  • Edit the Post Web Part

  • Set the XSL Link to xsl/blogPost.xsl and click OK

  • Test the changes to make sure Area is included

 

Duplicated people search result

When searching for a person in Fast Search Centre, duplicated user profile returns.

Cause

Multiple People Content Sources are defined for the same farm. You only need to have one Content Source for user profile crawling.

Resolution

  • Make sure that you use the FAST Query SSA to crawl User Profile. You should not use the FAST Content SSA.
  • Make sure you only define one Content Source for User Profile Crawling.
  • Reset Index
  • Re-start Full Crawl

 

How to install and configure Adobe IFilter For SharePoint Search

These are the instructions to set up SharePoint to crawl and display pdfs in the results:

  • Download the ifilter msi file from http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025
  • Unzip the downloaded file and ensure the msi file is in a folder of your choice
  • Find an icon for PDF and save it as ICPDF.gif to the same folder
  • Create a new text file called ifilter-install.txt in the same folder and paste the following

# Enter the following variable…

$searchSSAName = "Search Service Application Name" #Enter the name of the Search Service Application here

Write-Host "Loading SharePoint 2010 PowerShell cmdlets – Global"

Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

$ParentDirectory = Split-Path $pwd -parent

cmd.exe /C "$ParentDirectory\PDFFilter64installer.msi /passive"

write-host $ParentDirectory

copy-item "$ParentDirectory\ICPDF.gif" -Destination "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\"

$pngmappingkey = ' <Mapping Key="png" Value="icpng.gif"/>'

$pdfmappingkey = ' <Mapping Key="pdf" Value="ICPDF.gif"/>'

$dociconxmlpath = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML"

$dociconxmlentry = "$pngmappingkey`r`n$pdfmappingkey"

(get-content $dociconxmlpath\DOCICON.XML) | foreach-object {$_ -replace "$pngmappingkey", "$dociconxmlentry"} | set-content $dociconxmlpath\DOCICON.XML

New-Item -path "HKLM:\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf" -erroraction SilentlyContinue

New-ItemProperty "HKLM:\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf" -Name "(Default)" -PropertyType string -value "{E8978DA6-047F-4E3D-9C78-CDBE46041603}" -erroraction SilentlyContinue

$searchapp = Get-SPEnterpriseSearchServiceApplication $searchSSAName -erroraction SilentlyContinue

$searchapp | New-SPEnterpriseSearchCrawlExtension "pdf" -erroraction SilentlyContinue

cmd.exe /C iisreset

net stop "SharePoint Server Search 14″

net start "SharePoint Server Search 14″

  • Open the ifilter-install.txt file and enter the $searchSSAName variable. This should be the exact name of the Search Service Application.
  • Rename the attached ifilter-install.txt to ifilter.ps1
  • Run the ps1 file on SP front-ends…

 

Missing FAST Search keywords, site promotion and demotion, user context from Site Collection Administration

Symptoms

When you go to Site Settings, the following items are missing from the Site Collection Administration:

  • FAST Search keywords
  • FAST Search site promotion and demotion
  • FAST Search user context

Cause

This usually happens when you add FAST Search to an existing SharePoint 2010 farm.

The feature that activates these functions may not enable for the site collection.

Resolution

Run the following command on the SharePoint server in Powershell as Administrator (replace [SiteURL] with the actual URL):

Enable-SPFeature -id "5EAC763D-FBF5-4d6f-A76B-EDED7DD7B0A5″ -Url  [SiteURL]

 

How to add Adobe PDF to SharePoint Advanced Search result type drop down list

By default, Fast Search Advanced Search does not include Adobe PDF on the Result type filter.

So, to add a new result type for Adobe PDF, please follow the following steps:

  • Edit the Advance Search page

  • Edit the Advanced Search Box web part

  • Expand Properties

  • Click the button next to the Properties textbox and copy the text to an XML Editor (for easy editing)

  • In the XML Editor, add the following before the ResultTypes closing tag

<ResultType DisplayName=”Adobe PDF” Name=”acrobatpdf”>

<KeywordQuery>FileExtension=”pdf”</KeywordQuery>

<PropertyRef Name=”Author” />

<PropertyRef Name=”DocComments”/>

<PropertyRef Name=”Description” />

<PropertyRef Name=”DocKeywords”/>

<PropertyRef Name=”FileName” />

<PropertyRef Name=”Size” />

<PropertyRef Name=”DocSubject”/>

<PropertyRef Name=”Path” />

<PropertyRef Name=”Write” />

<PropertyRef Name=”CreatedBy” />

<PropertyRef Name=”ModifiedBy” />

<PropertyRef Name=”Title”/>

</ResultType>

  • Copy the changes back into the SharePoint Advance Search Box Properties Text Editor, and click OK.

  • Click OK on the Advance Search Box Panel

  • Click Save & Close to save the changes to the page

  • Check the Result Type drop down list and make sure Adobe PDF is in the list.

 

SharePoint 2010 calculated column and hyperlink (no workflows or scripts required)

Often you will get a requirement like this:

Create a calculated column which concatenate the url text with an existing column value.

This seems to be an easy task, except one thing: SharePoint doest not render hyperlink in calculated column by default.

For example, I have a list with 2 columns: Search term and Google Search. Google Search is a calculated column with this formula

 

 

Now, this is what I will get by default:

There are a few ways to fix this problem. Usually people will recommend you to create a Hyperlink column instead and create a workflow to update the Hyperlink value (http://social.technet.microsoft.com/Forums/ar/sharepoint2010customization/thread/32d32e47-3256-4806-8775-c250b6243038) . Or, you can place a script on the page that loop through the HTML nodes and replace the unfriendly html tags with a hyperlink as described here http://practicalsharepoint.blogspot.com/2011/10/dynamic-hyperlinks-in-calculated.html.

But today, I’m going to show you how to trick SharePoint into displaying the hyperlink, and it is going to be very easy.

1. Modify the calculated column and change the returned data type from Single line of text to Number/Currency/Date and Times. Click OK.

2. Go back to the list and be amazed :)

This will also work when you’d like to achieve the same thing with the image tag <img>.