Tuesday, November 5, 2013

Lync 2010 Skill Search Configuration with SharePoint 2010 People Search

In this post I want to show you how to configure the skill search in Lync 2010. Lync uses the SharePoint Search Web Service to search after user skills.The skills are stored in the SharePoint User Profile Store.


  • Lync Server (min. Standard)
  • SharePoint Server 2007 or later (No WSS or SharePoint Foundation)
  • Lync Client (No OCS)


The final result looks like that:

Enter a skill you want to search, here "SharePoint".

Now click on Skill tab.

You'll get a list of users who entered SharePoint as skill in their profile.

1. How to edit your skills.

The skills are stored in the SharePoint User Profile Store. For that you have to enable and configure MySite in SharePoint. If MySite is enabled you can enter your profile page and edit your skills field.

First open your MySite. Then go to the top right corner on a SharePoint page and open the personal menu. Click on "My Profile"

Open My Profile Page
Now you enter the "My Profile" page in the MySite web application.

Click on "Edit My Profile" to edit your profile properties.

When you scroll down you'll see the "Skills" field. Here you can enter your skills for the skill search in Lync. Save your new skills and exit the page.

As the SharePoint 2010 search service is used. Your skills are not displayed immediately. You have to wait until the SharePoint search crawls your properties. The schedule for that is set individually by the SharePoint administrator.

2. Check if People Search is working

The next step is to test if the people search is working properly. For that open an existing search site in SharePoint or create a new search site with the Enterprise Search Template. You'll need the url of the search result site later for Lync. In my case the search result page has the url:

  • http://sharepoint-st/sites/search/pages/peopleresults.aspx. 

Please do not mix up the search page with the search result page. These are two pages with 2 different urls.

Search result page

Normally people search is a standard feature in SharePoint and don't need to be configured specially. If your  SharePoint people search is unlikely corrupt you only need the following settings:

  • A content source which crawls the user profiles. It must have a start address with the sps3 protocol: e.g. sps3://mysharepoint
  • A scope called "People" in your scopes with the rule "contentclass = urn:content-class:SPSPeople"

Now check also if the SharePoint Search Service can be called without problems. Type http://{yourwebbapp}/_vti_bin/search.asmx to display the service methods. If you see a list of service methods the service application is running.

3. Configure Lync 

Now we have to tell the Lync client where he can search for skill. Therefore it needs to know the url of the search service. For this Lync has client policies. 

In a client policy you can define what a Lync client can do and where he can find his connection stuff. You can see the client policy settings if you right click + CTRL on the Lync taskbar icon.

The best way to test skill search is to create a temporary Client Policy. Go to your Lync Server and open the "Lync Server Management Shell". To create a client policy type:

C:\>New-CSClientPolicy -Identity TempClientPolicy

To list all policy properties type:

C:\>Get-CSClientPolicy -Identity TempClientPolicy 

The important properties here are:
  • SPSearchInternalURL: The url of the search service
  • SPSearchExternalURL: The url of the search service for external users. Maybe you have a SharePoint in the DMZ for external users, then you have to enter this url here.
  • SPSearchCenterInternalURL: The URL of the search result page for people search. Lync needs this to create a link which opens the SharePoint Site. Usually in the SharePoint search results there are more information displayed.

  • SPSearchCenterExternalURL: The same for external Lync.

If not configured the SPSearch properies are empty

Now edit the properties with the SharePoint Search Service and People Result Page Infos. To edit a property open the Lync Management Console on the Lync Server and type (You have to be a Lync Administrator): 

C:\>Set-CSClientPolicy -Identity TempClientPolicy -SPSearchInternalUrl "http://sharepoint-st/_vti_bin/search.asmx"

C:\>Set-CSClientPolicy -Identity TempClientPolicy -SPSearchExternalUrl "http://sharepoint-st/_vti_bin/search.asmx"

C:\>Set-CSClientPolicy -Identity TempClientPolicy -SPSearchCenterInternalUrl "http://sharepoint-st/sites/search/pages/peopleresults.aspx"

C:\>Set-CSClientPolicy -Identity TempClientPolicy -SPSearchCenterExternalUrl "http://sharepoint-st/sites/search/pages/peopleresults.aspx"

The final result must be:

C:\>Get-CSClientPolicy -Identity TempClientPolicy 

Now assign the policy to a test user. You can do that with PowerShell or over the Lync Control Panel.

C:\> $user = Get-CSUser "domain\login"  
C:\> $user  
C:\> Grant-CsClientPolicy -Identity "domain\login" -PolicyName TempClientPolicy
C:\> $user 

Check on the displayed properties of the user if the client policy is assigned. You have to logout and login again to retrieve the new policy. Check the Lync configuration settings (CTRL + Right click on icon)  if the SharePoint properties are filled.

Things to pay attention to:
  1. There is a problem when calling the SharePoint 2010 Search Service and anonymous authentication is enabled. If the web application http://sharepoint-st has anonymous authentication enabled you would see "SharePoint people search failed. Please try again later. If the problem continues, contact the sysadmin". The best way to solve this issue may to create a seperate web application which uses the same search service application.
  2. As the url of the web service is http://sharepoint-st/_vti_bin/search.asmx you should grant all user at least read rights on the site collection (In this case the main site collection)
  3. Lync is calling the SharePoint Web Service with a predefined search query. In WireShark you can see the following xml:
    <QueryText language='en-US' type='string'>SharePoint scope:People</QueryText>
    That means you'll need the scope "People". Don't delete or rename the scope it if you want to use skill search.
  4. All 4 SPSearch client policy properties should be set. Sometimes if not all properties are set Lync throws an error that people search has failed.

5. Migrate the policy

In the last step you have to define which persons should have the ability to search after skills. You can edit the global client policy, create a site policy for a special Lync site or a single policy and assign the policy each user.

  1. Edit the global policy to assign every user this policy

    C:\>Set-CSClientPolicy -Identity global -SPSearchExternalUrl "http://sharepoint-st/_vti_bin/search.asmx"
  2. Create a or edit site policy:

    C:\>New-CSClientPolicy -Identity site:IstanbulC:\>Set-CSClientPolicy -Identity site:Istanbul -SPSearchExternalUrl "http://sharepoint-st/_vti_bin/search.asmx"
  3. The client policy for the skill search can also be configure on a user level

    C:\>New-CSClientPolicy Tag:Messi -SPSearchExternalUrl "http://sharepoint-st/_vti_bin/search.asmx"
  4. Create a user policy: You have to create a new client policy like we did it in the example above. The next step is to create a script which loops through all the users assigns them the policy. This is the most complicated way because you have to assign the policy each time your company gets a new employee.

How does it work internally

Lync creates a search request for the SharePoint Search Web Service. The web service s attending a request in form of XML. Lync picks up the entered search word e.g. "Finance Controller" and creates the XML for the query:

<QueryPacket xmlns='urn:Microsoft.Search.Query'>
      <QueryText language='en-US' type='string'>Finance Controller scope:People</QueryText>

In the request there is a xml section for properties. This section contains all the properties the requester wants to see in his results.

      <Property name="preferredname" HitHighLight="true"/>
      <Property name="jobtitle" HitHighLight="true"/>
      <Property name="department" HitHighLight="true"/>
      <Property name="officenumber" HitHighLight="true"/>
      <Property name="workemail" HitHighLight="true"/>
      <Property name="responsibility" HitHighLight="true"/>
      <Property name="sipaddress" HitHighLight="true"/>
      <Property name="pastprojects" HitHighLight="true"/>
      <Property name="interests" HitHighLight="true"/>
      <Property name="memberships" HitHighLight="true"/>
      <Property name="aboutme" HitHighLight="true"/>
      <Property name="hithighlightedsummary"/>
      <Property name="hithighlightedproperties"/>
      <Property name="path"/>
      <Property name="description"/>
      <Property name="write"/>
      <Property name="rank"/>
      <Property name="size"/>
      <Property name="yomidisplayname" HitHighLight="true"/>
      <Property name="orgnames" HitHighLight="true"/>
      <Property name="orgparentnames" HitHighLight="true"/>
      <Property name="baseofficelocation" HitHighLight="true"/>

We see that the request contains "SipAddress" and "WorkEmail". Lync uses this properties to create a relation the corresponding Lync user. If the SipAddress does not exist Lync uses the WorkEmail property to create a relation between the result and the Lync user.

Lync sends the request to configured (in the client policy) the SharePoint search service. The service response is also in XML format.

As there is only a restriction in scope this means that if you want you can create custom properties in SharePoint which could be also searched.

Error Handling

The error handling in Lync 2010 provides meaningful explanations about errors that are thrown from SharePoint. The following  illustrates the error messages that are displayed by Lync 2010 when the corresponding SharePoint error code is returned.

SharePoint Error Code
Corresponding Lync 2010 Error Message
Your query did not contain any words that can be searched. No results are available. Please enter a new query.
Unable to connect to the server. Please try again later.
If the problem continues, contact your system administrator
SharePoint people search failed due to a malformed query.
SharePoint people search failed due to a malformed query.
SharePoint people search failed due to a malformed query.
No results found.
SharePoint people search failed due to a malformed query.
You do not have permissions to connect to the search server. Please contact your system administrator.

If Lync is unable to connect to SharePoint, one of the following error messages is displayed:
  • “Unable to connect to the server. Please try again later. If the problem continues, contact your system administrator.” This is a general error that is displayed when Lync 2010 cannot make a connection to SharePoint
  • “Skill Search is not available. Your system administrator might not have configured Skill Search to work using your current network, or there may be a problem accessing the SharePoint server.” This error message is displayed when one of the two in-band provisioning settings is not configured. If one of the two settings (SPSearchInternalURL or SPSearchExternalURL) is not configured properly, Lync 2010 cannot determine if the problem is related to network connectivity or to an improperly configured URL.

All other SharePoint error codes display the following error message: “SharePoint people search failed. Please try again later. If the problem continues, contact the system administrator.”


Thursday, October 10, 2013

SharePoint 2013 Cumulative Update Error - The expected version of the product was not found on the system

I got this error while I was trying to install the Cumulative Updates August 2013. The reason for this error is that the baseline for all updates is the first Cumulative Update in March.

I checked my build version of the farm

and found out that I've installed the RTM version.

If this doesn't solve your problem you can try to start the ubersrv2013-kbxxxxxx-fullfile-x64-glb.exe with the parameter PACKAGE.BYPASS.DETECTION.CHECK=1 like:

ubersrv2013-kbxxxxxx-fullfile-x64-glb.exe PACKAGE.BYPASS.DETECTION.CHECK=1

( Do not forget to start the command as farm administrator )

This bypassed all checks so that you can force the installation.


Monday, September 30, 2013

Nintex Workflow 2010 - Multiple Dynamic E-Mail Attachments

We have a Nintex Workflow and I need to send a list of documents in a folder to a customer as email attachment. Sound easy !!

Although this could be an easy tasks unfortunately I couldn't find an easy way to do this, because the "Attachment" input element only takes a full path to a single file.

That means you can't loop through a folder and collect all files with a seperator in a variable and give it to the attachment control. Or better would be to collect all paths in the "Collection" variable and give this variable to the attachment control. This also does not work in my Nintex version. Maybe the Nintex guys already added this feature.

The only way I found is to save each file in a separate variable. So I had to make a restrictions like, "I've maximum 5 attachments".

So in my Workflow I've 3 variables (you can have more):

  • fileAttachPath: Contains the path to the folder like http://sharepoint/sites/projectX/docs
  • fileAttach1: is initialized with fileAttachPath (single line of text)
  • fileAttach2: is initialized with fileAttachPath (single line of text)
  • filesCollection: a collection variable to hold the files
  • fileToAttach: Need when we loop throught filesCollection (single line of text variable)

We initialize the variables fileAttach1/2 with fileAttachPath because an empty variable would cause an error in the email attachment. See http://connect.nintex.com/forums/thread/18201.aspx.

Now we have a list lookup task which loops through the list and writes the names of the files into a collection variable

Now comes a tricky one. We have to write the attachments into the variables. We need "For Each" task. We loop through the "filesCollection" variables and write each item into the filesToAttach variable.

Next we use "Run If" task to fill our variables. We begin with the highest variable, im my case "fileAttach2".
The condition is:

  • Check if fileToAttach = fileAttachPath and
  • fileAttach1 is not fileAttachPath

If we had more than 2 attachments we would check the prior one.

If this is successfull fill the variable fileAttach2 with the path to the file:

The last check is the one for the variable fileAttach1.

Now we can add the variables as attachments to any email in Nintex.

Here a look to the workflow diagram  (It's in german but it should be clear)

If someone found a better way, comments are appreciated.

Monday, September 23, 2013

Ways to redirect http requests in SharePoint

The are multiple szenarios when you need a redirect in SharePoint:

  • You've migrated SharePoint into a new URL (e.g http://sp2010 to http://sp2013)
  • You moved a site collection
  • You moved a sub site into a new site collection

If you want to redirect in SharePoint without custom solutions you have the following options:

Redirect with XML Viewer or Content Editor WebPart

You can redirect with JavaScript by inserting a WebPart into the site and adding simple JavaScript. This is easy to configure but redirects only the site in which the WebPart sits (Probably the Mainsite). If users have saved links the their document libraries this method fails, unless you put the same WebPart into the document library.

So go to the site you want to redirect and the XML Viewer WebPart. Open the WebPart settings and add the following line of code:

<script type="text/javascript">
location.href = "<<the url you want to redirect>>";

One drawback of this way to redirect is that you don't have an easy on/off button to activate this redirect. Once the WebPart is saved you can't edit the site anymore, because you're always redirected.

If you want to edit the site you'v to remove the WebPart by typing the URL and adding the querystring ?contents=1 to the site url like http://sharepoint/myproject?contents=1

You can also use the html meta tag "refresh" to redirect your page. Here is an example with a popup indicating that the page has moved and the meta tag.

IIS HTTP Redirect

This is a feature in IIS which have to be enabled. It is used to redirect all requests to another destination. This fits perfect when you have upgraded SharePoint.

Check within the Server Manager in the Web Server Role if this feature is already installed. Otherwise you can install it also from the command line:

dism /online /Enable-Feature /FeatureName:IIS-HttpRedirect

After you've enabled this feature you'll see it in the IIS Manager.

The HTTP Redirect Feature

Click on your SharePoint webapplication and then on "Http Redirect" to open the feature. 

In this example we migrated to from SharePoint 2010 to SharePoint 2013. The new url ist http://sp2013. So when someone enters the url http://sp2010/sites/myproject he should be redirected to  http://sp2013/sites/myproject.

Configure Redirect

If you want to do more granular redirect like including query parameter you can use parameter like $V and $Q. 

When you edit and apply redirect clear your browser cache for testing.


Redirect with URL Rewrite 2.0 Module

The URL Rewrite 2.0 Module is not a feature in IIS 7.5. It has to be downloaded and installed from here. Once installed you can see the module within you features in IIS.

URL Rewrite module

This is a very might tool as you can use wildcard and regular expression. This means that you can also redirect untill item level in SharePoint.

In the following example I moved a site "projectx" under http://sharepoint into an own sitecollection http://sharepoint/sites/projectx.

Open the URL Rewrite Module in IIS within your webapplication. Click on "Add Rule" on the right pane. Add a name for your rule like "Redirect Projectx into Sitecollection"

The pattern must be server relative. Check Using "Wildcards" as we use asterisks "*" within the pattern.

In the action pane select "redirect" and the type the url you want to redirect. I added also "{R:1}" at the end of the redirect. This is a parameter which delivers all the right side from the pattern. So you can redirect all request under http://sharepoint/projects/xxxxx to http://sharepoint/sites/projectx/xxxxx.

You can see the parameters when you test the pattern by clicking "Test Pattern".

The rewrite module provide lots of more options for a granular redirect. You can check within the link I've provided in the reference.

Please not that when you apply a rule the web.config of the webapplication is changed and you get an IIS refresh. Another thing to pay attention is a when you change a rule, the rule is applied when you disable and enable it again.


Thursday, September 19, 2013

Move a SharePoint Team Wiki Library between SharePoint Sites or Site Collections

In this post I describe how you can move a team wiki from one site to another. The difficulties here are:

  • The "Save as Template" option in the list settings does not exist. This is because this type of list is deprecated. In SharePoint 2010 you should use Enterprise Wikis.
  • After copying the list, the links in the wikis site must be adapted to the new site.

Ways to copy the Wiki Library

The are three "easy" ways to copy the Wiki Library from one site to the other. The "Save As Template" Link does not exist in the Library Settings but the option still exists.

SharePoint Designer

Open the site with the SharePoint Designer. Click on your wiki and go the the library settings. You'll find a "Save as template" button there.

"Save as Template" option in SharePoint Designer

SharePoint UI

You can use the standard "Save As Template" UI by modifying the URL

Go to the Wiki Library. Normally you browse the first wiki site, but go to the wiki library page by typing  /wikilibname/Forms/AllPages.aspx or by the Ribbon

"All Pages" in a wiki site
Now go the library settings.
Wiki Library Settings

Here change the url. Replace "listedit.aspx" by "savetmpl.aspx" in the browser and you will land at the "Save As Template" Site.
"Save as Template" form


You can also save a wiki template with PowerShell. This option is interesting for farm admins. Open the SharePoint Management Shell and type the following:

After the command ends succesfully you should have a template in your list templates gallery.

Download & Copy Template

Now download the template from the list templates gallery in the old site and upload it to your new site into the list templates gallery.

"List templates" gallery in your site collection

Upload a new template into your gallery

Create a new library from your template. Go to "View All Site Content" then "Create" and select your new template.

Adapt Wiki Links

To adapt the links within your wiki content either you do it manually or by PowerShell. If you haave the option to use PowerShell I can offer the following script.

Adapt the variables for your environment and start the script within the SharePoint Management Console. This script will loop through all your wiki items and adapt the links within your content.

 <# PowerShell Script to adapt Team Wiki Content Links after migration #>  
 # Setup Basic sites and pages  
 $teamWikiWebUrl = "http://sharepoint/sites/newweb"  
 $wikiListName  = "Applications Wiki"  
 $oldLink     = "/sites/oldweb/team%20wiki/"  
 $newLink    = "/sites/newweb/team%20wiki/"  
   Write-Host -foregroundcolor green " >> STARTING ..."  
   Write-Host -foregroundcolor green "`t1. Getting Wiki List."  
   $wikiWeb  = Get-SPWeb $teamWikiWebUrl  
   $wiki     = $wikiWeb.Lists[$wikiListName]  
   Write-Host -foregroundcolor green "`t2. Start adapting links."  
   foreach ($wikiItem in $wiki.Items) {                  
     # Replace the links in the new content  
     Write-Host -foregroundcolor green "`t`t>>Adapting links in: " $wikiItem.Name  
     $content   = $wikiItem["ows_WikiField"]  
     $newContent = $content -replace $oldLink, $newLink    
     # Add new content to the page  
     $wikiItem["ows_WikiField"] = $newContent  
   Write-Host -foregroundcolor green  "`t3. All Links adapted !!"    
 catch [System.Exception] {  
   Write-Host "Error while adapting Wiki links...`n" -foregroundcolor red  

Thursday, September 12, 2013

How to create a FAQ in SharePoint with OOB features

There are lots of stuff in the web around how to create a FAQ in SharePoint.

In this post I'll show you some tricks what you can do with additional OOB SharePoint tools to have also some search and some style within your FAQ to impress your customer. It also shows you the power of SharePoint as a developer platform.

The requirements for our FAQ are:
  • Easy to maintain
  • Easy to search content
  • Add documents as links in FAQ
  • Grouped FAQ content
  • Export FAQ when needed into a report

To understand this post you should have some basic know-how about:
  • SharePoint Lists
  • SharePoint List Views
  • JavaScript (SharePoint Client API)
  • SharePoint WebParts
  • CAML
or you just follow the instructions.

The following image shows us the final page.

Final FAQ Pag

Our FAQ page has a FAQ list and a document library. This is useful if you want to link on some documents in your FAQ. The page has a list WebPart with a special grouped view and also2 quick searches for documents and for the FAQ list.

I also use a category for my FAQ. To manage the category I've an own list "Basic themes", where the FAQ owner can manage his categories.

Steps to create the FAQ

1. STEP : Create a site

Create a own site collection for your FAQ. Use the blank site template.

2. STEP : Create the Basic Themes List

Use the "Custom List Template" to create the Basic themes List. Name the list "Basicthemes". This list
will be referenced by the FAQ list for categorize the FAQ. This list does need nothing but a title. This titles will categorize our FAQ.

3. STEP : Create a document library

Create a standard document library and call it "Documents". This library will contain documents referenced by the FAQ.

4. STEP : Create the FAQ List

Use the "Custom List Template" to create the FAQ List. Name the list "FAQ".

Our FAQ needs now some fields. You can easily add more fields if you want but for my FAQ I took the following fields:

Field nameField type
TitleSingle line of text
ThemeLookup to Basic Themes List on Title
QuestionMultiple line of text
AnswerMultiple line of text

5. STEP: Create a group view

Go to the FAQ list and create a new view. Call it "WebPart View". Use following settings

View option Option values
Fields : Question, Answer
Group by : Theme than title
Format: Magazine

6. STEP: Create an asset library

Create a document or asset library and name it "Site Assets". This library will contain some scripts we need for the site.

7. STEP Upload Quick Search Scripts

Upload the following scripts to the "Site Assets" library. Adapt the list/site names in the scripts with the names of your list/site.

Search FAQ Script

Script to search FAQ content. Copy the code into a .txt file and upload it to the "Site Assets" library.
Adapt the list url and site url settings in the code. Check in the "BAR.CreateXML" function that the field names are set correct like in your library.

This script contains also some css to make the list view more readable.

 <style type="text/css">  
 #SearchResults ul { padding-left:10px }  
 #SearchResults li { margin-bottom:5px }  
 #SearchResults span { color:#666 }  
 .biggySearcher div.s4-search { width:100%; height:30px }  
 .biggySearcher .ms-sbplain { width:150px }  
 .ms-listviewtable tbody tr+tr+tr .ms-rtestate-field {  
  font-size: 14px;  
  padding:2px 0;  
  border-bottom:1px solid #de3400  
 .ms-listviewtable tbody tr+tr+tr+tr .ms-rtestate-field {  
  font-size: inherit;  
 <script type="text/javascript">  
 if (typeof BAR == "undefined") {  
   BAR = {};    
 BAR.siteUrl   = "/sites/claims";  
 BAR.listName  = "FAQ"; // Displayname  
 BAR.listUrl    = BAR.siteUrl + '/Lists/faq'  
 BAR.resultItems = null;

 BAR.StartQuery = function() {  
   var text = document.getElementById("QueryText").value;  
   text = text.replace(/^\s+|\s+$/g, ""); // Trim  
   var result = BAR.CreateQuery(text);  

 BAR.CreateQuery = function( pSearchText )   
   var result = "";  
   var searchWords = pSearchText.split(" ");  
   for (var i=0;i<searchWords.length;i++){  
     if (searchWords[i] != "") {  
       if (i>0) result = "<And>" +result;  
       result += BAR.CreateXML(searchWords[i]);  
       if (i>0) result += "</And>";  
   return result;  

 BAR.CreateXML = function(pSearchText) {  
 return ' <Or>'  
   + ' <Or>'  
   + '  <Contains>'  
   + '    <FieldRef Name="Title" />'  
   + '    <Value Type="Text">'+ pSearchText +'</Value>'  
   + '  </Contains>'  
   + '  <Contains>'  
   + '    <FieldRef Name="Question" />'  
   + '    <Value Type="Note">'+ pSearchText +'</Value>'  
   + '  </Contains>'  
   + ' </Or>'  
   + '  <Contains>'  
   + '    <FieldRef Name="Answer" />'  
   + '    <Value Type="Note">'+ pSearchText +'</Value>'  
   + '  </Contains>'  
   + ' </Or>'  

 BAR.QueryList = function(pSearchXML){  
   var context = new SP.ClientContext(BAR.siteUrl);  
   var oList = context.get_web().get_lists().getByTitle(BAR.listName);  
   var camlQuery = new SP.CamlQuery();  
   + '<Where>'  
   + pSearchXML  
   + '</Where>'  
   + '</Query><RowLimit>10</RowLimit></View>');  
   BAR.resultItems = oList.getItems(camlQuery);  
   context.load(BAR.resultItems, 'Include(Id, Title, Frage, Basisthema)');  
     Function.createDelegate(this, BAR.onQuerySucceeded),   
     Function.createDelegate(this, BAR.onQueryFailed)  

 BAR.onQuerySucceeded = function(sender, args) {  
   var resultHTML = [];  
   var listItemEnumerator = BAR.resultItems.getEnumerator();  
   var i = 0;    
   while (listItemEnumerator.moveNext()) {  
     var oListItem = listItemEnumerator.get_current();      
     var id  = oListItem.get_id();  
     var theme = oListItem.get_item('Basisthema').get_lookupValue();  
     var title = oListItem.get_item('Title');  
     var quest = oListItem.get_item('Frage').substr(0,120);  
     resultHTML.push('<a href="javascript:EditItem2(null,\''+ BAR.listUrl +'/DispForm.aspx?ID='+ id +'\')">' + title + '</a>');  
     resultHTML.push('<br/>('+ theme +')');  
     resultHTML.push('<br/><span>'+ quest +' ...</span>');  
   if (i == 0)  
     resultHTML.push('<li><span>No FAQ entry found.</span></li>');  
   document.getElementById("SearchResults").innerHTML = resultHTML.join("");  

 BAR.onQueryFailed = function(sender, args) {  
   alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());  

 <div class="biggySearcher">  
   <div class="s4-search">      
     <table class="ms-sbtable s4-search"><tr>  
     <td class="ms-sbcell">  
       <input type="text" class="ms-sbplain" id="QueryText" />  
     <td class="ms-sbgo ms-sbcell">  
       <img src="/_layouts/images/gosearch15.png" alt="Search" class="srch-gosearchimg"   
         onmouseover="this.src='\u002f_layouts\u002fimages\u002fgosearchhover15.png'" title="Search"  
         onclick="BAR.StartQuery()" />  
   <ul id="SearchResults"></ul>  

Script to search the document library

The second script is to set a search. The search results appear in a dialog box. I find this very handy. Copy now the following script into a .txt file and upload it also to your site assets library. Adapt the list and site parameters in the script to search the correct site and library .

 <script type="text/javascript">  
 if (typeof BAR == "undefined") {  
   BAR = {};    
 BAR.siteUrl   = '/sites/myfaq';  
 BAR.documentLibUrl = 'http://sharepoint/sites/myfaq/documents'  
 BAR.QueryDocs = function() {    
   var text = document.getElementById("QueryTextDocs").value;  
   text = text.replace(/^\s+|\s+$/g, ""); // Trim  
   text = "*" + text + "*"    
   EditItem2(null, BAR.siteUrl + '/_layouts/OSSSearchResults.aspx?k=' + text + '&cs=This%20List&u=' + encodeURIComponent(BAR.documentLibUrl) );  
 <div class="biggySearcher">  
   <div class="s4-search">  
     <table class="ms-sbtable s4-search"><tr>  
     <td class="ms-sbcell">  
       <input type="text" class="ms-sbplain" id="QueryTextDocs" />  
     <td class="ms-sbgo ms-sbcell">  
       <img src="/_layouts/images/gosearch15.png" alt="Search" class="srch-gosearchimg"   
         onmouseover="this.src='\u002f_layouts\u002fimages\u002fgosearchhover15.png'" title="Search"  
         onclick="BAR.QueryDocs()" />  

8. STEP: Insert the FAQ List into your page

Goto your home site and click on edit. Add your FAQ list to the middle WebPart section. Click on "Add WebPart" and choose the FAQ list. Choose the WebPart View from the WebPart settings.

9. STEP: Insert FAQ Document Search

Goto your home site and click on edit. Add a "Content Viewer WebPart" to the right WebPart section. Go to the WebPart settings and put into the top text box the path to the uploaded txt file, which contains the documents query.

10. STEP: Insert FAQ Quick Search

Do the same for the FAQ query file.

11. STEP: Adding category filter WebPart

In this step we want to add the category filter:

Go to your home site and click on edit.Click on "Add WebPart" on the right section and choose the "HtmlFormsWebPart" from "Forms" category.

The cool thing about the html forms WebPart is that you can connect to other WebParts with it.

Open the settings of this WebPart and click on "Sourcecode editor". Put the following source code in it. Check if the list name in the code "Basicthemes" matches your list name, else change it to your list name.

This code loads the entries from the "Basicthemes" list into a dropdown menu, which can be used for filtering.

 <div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_" style="margin-bottom:5px">  
   <select id="selThemes" name="T1"></select>  
   <input type="button" value="Filter" onclick="javascript:_SFSUBMIT_"/>  
 <span style="height:11px;width:11px;position:relative;display:inline-block;overflow:hidden;">  
   <img style="position:absolute;border:0;left:0;top:-584px" src="/_layouts/images/fgimg.png" />  
 <a href="javascript:location.href=location.href">Reset Filter</a>  
 <script type="text/javascript">  
  function LoadSelectThemes() {  
   var context = SP.ClientContext.get_current();  
   var list = context.get_web().get_lists().getByTitle('Basicthemes');  
   var camlQuery = SP.CamlQuery.createAllItemsQuery();  
   var items = list.getItems(camlQuery);    
   context.load(items, 'Include(Title, Id)');  
       var listItemEnumerator = items.getEnumerator();  
       var oSelect = document.getElementById("selThemes");  
       while (listItemEnumerator.moveNext()) {          
         var oListItem = listItemEnumerator.get_current();  
         var title = oListItem.get_item('Title');          
         var option = document.createElement("option");  
         option.innerHTML = title;  
         option.value = title;  
         if (oSelect != null){            
     function(sender, args) {  
       alert('List Data fetch failed. ' + args.get_message() + 'n' + args.get_stackTrace());  
  window.onload = function(){ ExecuteOrDelayUntilScriptLoaded(ViewItem, "sp.js"); };

12. STEP: Connecting the filter

In this step we connect the Form WebPart with the list view WebPart on the site. Edit you home site. Go to your WebPart Menu of your HTML Form WebPart and click on connections and choose FAQ.

In the upcoming Window choose :
  • Source field = T1
  • Consumer field = Themes (The Lookup field)

Click on "Save" and save your WebPart Settings. The connection should be etablished now.

13. STEP: Testing

Most things should be straight forward. The HTMLFormWebPart caused me sometimes that the whole site stopped working because of wrong JavaScript code. In this case remove the WebPart by adding ?contents=1 to the URL. You will be redirected to the WebPart maintanance page.
Other problems can be that the list or site names are wrong in the scripts. Pay attention that you change every setting. Search & replace is a good tactic in such a case. You can also edit the .txt file in the site assets library in Explorer View directly in NotePad++. So don't have to down- and upload everytime.

SharePoint Installation Claims Error: Failed to create instance of cookie value handler type / handler object

I got this error while installing SharePoint 2013 with AutoSPInstaller.

STS Call Claims Windows: Failed to get cookie value handler type / object

Opening the logs I saw following error messages:

This error was also caused when I tried to use Get-SPSite -Limit All

As the error says that it is a claims problem I first checked the SharePoint Security Token Service but the web service was fine. When I browse the web service, the page is rendered without errors:

  • Check if Windows Web Services Pool has started
  • Check if "Claims To Windows Token Service" has started
  • Check if IIS checkbox "enable for 32bit Applications" is checked
  • Provisioning the Security Service again
  • Check if the "Claims To Windows Token Service" is running under Localsystem account
  • Check if in IIS > Windows Authentication "Enable Kernel Mode Authetication" is enabled
  • And Reinstalling SharePoint
I got still the same error.

Then I decided to debug the code and searched after the error message and found out the the error is thrown when an instance of the SPSessionSecurityTokenCookieValue object is made.

When you look at the constructor of this object:

the error is created from one of this calls. I opened a Powershell command and typed:


The result end in an error with something containing FIPS. And here It made click.

We had a GPO enabled, that only FIPS compliant algorithms for encryption should be used. Disable this policy and reboot to solve the problem

Following policies should be also checked:
  • Impersonate a client after authetication
  • Log on as a batch job
  • log on as a service