August 27, 2014

WAC doesn’t work from specific SharePoint Web Applications


WAC (Office Web Apps) works from some SharePoint 2013 web applications of a farm, but not from some. You get the normal errors when trying to view document on the problematic web application via WAC, like:

Sorry, there was a problem and we can't open this document. If this happens again, try opening the document in Microsoft Word.


Make sure the AAM settings for the web application are configured so that the URL being used is set as Default Zone. There are of course millions of other reasons for the error above, but in my case everything else was configured correctly.

Technorati Tags:

March 11, 2014

SharePoint: Web Part Title URL with Refinement QueryString parameter


I wanted to point SharePoint Web Part Title URL to a search results page with prepopulated refinement values. It didn’t work, as in Web Part settings, whenever I tried to input a valid URL with refinement parameter, I got error.

Example URL with refinement QueryString that didn’t work:




You need to encode the colon (:) with %3A, so Web Part Title URL field becomes


January 22, 2014

TFS: Delete workspace of another user


I changed my account on Team Foundation Server Online and had multiple workspaces bound to my old account, so when trying to create new workspace I could do so as there was already a workspace created for my old account.


You need to use TF command on Visual Studio command prompt to remove the old workspace. Syntax is:


as this was TFS Online, it was Microsoft Account, so in my case actual command was

tf workspace /delete "MIWORKSPACE;"

January 10, 2014

SharePoint: Hide list rows with CSR


I needed to hide certain rows on a list view on SharePoint 2013, namely all items that contained either _ or @ characters. I couldn’t use normal list view filtering as there is no “NOT CONTAINS” clause in CAML.

Solution a.k.a dirty hack

I’m not too happy with the outcome, but I just couldn’t figure out how to override item rendering and only render item row if Title of the item didn’t contain the characters in question. What I ended up doing was using Client Side Rendering together with jQuery and postRenderHandler to remove the TR rows from DOM.

I didn’t want to customize the XSLT of the XsltListViewWebPart and use a simple XSL:IF to filter out the items because as soon as I customized the XSLT in SharePoint Designer, the UI of the list reverted to SP2010 look and feel. I really wanted to maintain the SP2013 look.

Oh, and the code, put it into a file, and reference it from JSLink on your list view web part:

var MiPortalViews = MiPortalViews || {};

(function () {
  var MiPortalOverrides = {};
  MiPortalOverrides.Templates = {};

  MiPortalOverrides.OnPostRender = [];


function postRenderHandler()

January 8, 2014

SharePoint: Manually upgrade Service Application database


After upgrading from SharePoint 2010 to SharePoint 2013, I didn’t need to upgrade all possible Service Applications, but Managed Metadata was one I needed to upgrade. Following TechNet instructions and trying to create new Managed Metadata Service Application using the old SP2010 database never completer, the PowerShell command just stuck and never finished – also the MM Service Application was stuck in Stopped state and couldn’t be started with $mms.Provision().

So, I created fresh Managed Metadata SA, and restored the old database over the new one, after which the Database Upgrade Status page showed that the database would need to be upgraded, how to do that? First guess was $db.Upgrade(), but that wasn’t it.



In order to upgrade the database, you need to provision it. So, in PowerShell do the following:

  1. Get a list of databases: Get-SPDatabase
  2. Get a hold of the database you want to upgrade: $db = Get-SPDatabase <GUID OF THE DATABASE FROM PREVIOUS STEP>
  3. Finally do the upgrade: $db.Provision()

All done!

December 13, 2013

SharePoint FBA LdapRoleProvider login issue


After configuring Active Directory Forms Based Authentication (FBA) towards your Claims enabled Web Application successfully, users still cannot log in, but get generic error: “The server could not sign you in. Make sure your user name and password are correct, and then try again.”

You can assign permissions to users normally, so People Picker on Central Admin site and the actual portal site do find FBA versions of user accounts.

Even if you set ULS logs to Verbose, there isn’t a single row mentioning any errors or even verbose details of the login process. You have double-and triple checked that everything is configured OK.

Only error that is logged, is into Windows Application log:

Log Name:      Application
Source:        Microsoft-SharePoint Products-SharePoint Foundation
Date:          13.12.2013 12:19:25
Event ID:      8306
Task Category: Claims Authentication
Level:         Error
User:          SP\MyPortalAppPool
An exception occurred when trying to issue security token: The security token username and password could not be validated..



The interweb was full of valid reasons why this error is occurring, but none of them mentioned the most self-evident reason for the error message: your username is incorrect! The picture above actually already includes a simple textual instructions for users so they know what they need to type into the username field.

When moving from traditional Windows authentication to FBA, you no longer can use DOMAIN\username or email address as username. Instead you must use the “User logon name” as defined in AD user properties.



Technorati Tags:

October 22, 2013

SharePoint search query using date range


This is a quick one. Task was to search SharePoint items with specific date range, say, Created date being between (and including) 1/1/2013 and 12/31/2013. Every place on the internet this was asked, answer was to use queries like this:

Created>=1/1/2013 AND Created<=12/31/2013. 

Well, it works, but why not use the range operator?


Use the range operator .. (two periods) like this:


Note that range operator is inclusive, so you'll get items matching start and end dates of the range.