Wednesday, January 9, 2013

How to get thumbs to work with FS4SP when using Claims security in SharePoint

As stated in the Microsoft support article KB2554903 and KB2641517, document thumbnails with FS4SP and Claims based Authentication is not supported. There are also numerous threads on the Microsoft FS4SP forum about this.

I recently experiences this myself in a project and decided to fix it, because the fix is not really that hard. The issue is that when your browser calls http://server/_vti_bin/WACProxy.ashx it receives a 401 error due to it not handling claims.

A WSP for this solution can be downloaded from Codeplex. Note that the WSP will overwrite the existing WACProxy.ashx file, so you might want to create a copy of it first.

What I did was create a wrapper which calls the WACProxy running under elevated privileges instead, and switched out the existing WACProxy.ashx file with one pointing to my assembly.

using System.Web;
using Microsoft.SharePoint;

namespace mAdcOW.SharePoint
{
    public class WACProxy : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                var proxy = new Microsoft.Office.Server.Search.Extended.Query.Internal.UI.WACProxy();
                proxy.ProcessRequest(context);
            });

        }

        public bool IsReusable
        {
            get { return false; }
        }
    }
}


You might thing it’s very very bad running this in an elevated security context and thinking this might create a security hole. But it won’t. What the WACProxy does is sending back script which points to for example http://server/library/_layouts/MobilePageHandler.ashx. This call is then being executed by your browser using your logged in credentials. This means if you don’t have access to the document, you can’t generated a thumbnail for it either.

So we are merely running the call to generate the proper thumbnail URL in an elevated context to get around the claims error.

If you do not want to overwrite or replace the current WACProxy.ashx file, I have a webpart you can drop on the search page which will redirect calls to WACProxy.ashx to YourWACProxy.ash file instead. I will commit this to spsearchparts.codeplex.com at a later time.

Friday, January 4, 2013

Searching All items in Outlook 2013

I updated to Office 2013 not long ago and when I searching for old items they do not appear, but instead at the bottom of the search result it displays:

Showing recent results...

More

First I though this was some setting with the indexing in Windows 8 but Outlook was selected as a source. Then I stumbled upon a support article “Only a subset of your Exchange mailbox items are synchronized in Outlook 2013” which solved my issue. The setting also applies to Calendar, Contacts, Tasks, Journal and Notes items.

By default with Outlook 2013 and using Cached Exchange Mode only the past 12 months are synchronized. Changing this to “All” fixed the issue and I can now search all my items offline and quickly.

image

The above support article lists the steps on how to change how much to cache locally.

Thursday, November 29, 2012

FS4SP Logger v4 release

I’ve been so lucky to get Alexey Kozhemiakin to include some improvements on the rank log of this tool.

In addition to better formatting of the rank log and splitting it into more detailed parts showing for example which managed properties you got a hit in, the tool now also provides the raw ranklog information as well.

v4 is available for download at http://fs4splogger.codeplex.com/

image

Saturday, November 3, 2012

People Search and Extensibility in SharePoint 2013

If you are attending SPC12 and haven’t booked your session slot for Tuesday at 1:45PM yet, you might want to walk yourself over to #SPC191 and attend the session I’m presenting together with Sana Khan from Microsoft. [Add it to MySPC]

I will also be at the O'Reilly booth Monday at 3:15pm-3:45pm if you want to drop by for a chat about FAST Search for SharePoint 2010 or search in general.

Monday, September 24, 2012

What I’ve been up to lately

I haven’t been blogging for a while now and you might wonder why I’m not flooding my blog with 2013 content. Well, seems there is a good reason for it.
WP_000191I had my summer vacation all of July, and had promised myself not to do any extra curricular work. I kept that promise more or less even though I did post on the hardware requirements for 2013 dev. And that was just about how much 2013 work I did during the summer. But I did pick chanterelles with my son, which he’s quite good at even though it was his first time.

Wednesday, July 18, 2012

Hardware requirements - Developing for SharePoint 2013

If you are developing on-premise solutions where you deploy good old WSP packages to SharePoint, this is a post for you. If you are developing SharePoint Apps, you can get away with just about any setup (overly simplified statement).

The minimum recommended requirements for SharePoint development just got upped. TechNet recommends a minimum of 8GB ram and 4 cores. This is double of what was recommended for SharePoint 2010. My own tests show that you can perfectly well develop with 2 cores and 8GB ram on a single VM with DC, SQL, SharePoint 2013 and Visual Studio installed….if you have an SSD drive. You can also go down on ram to about 6GB depending on which features you use, but I think 8GB is acceptable.

Thursday, June 28, 2012

How-to: Get individual items from a delimited field using FS4SP

Thought I’d share a small useful program I often use when indexing data into FAST Search for SharePoint. The issue is that you get data back from some system where the values are concatenated into one field. For example:

user1,user2,user3

But you want to treat each value as a separate one. In FS4SP you have to delimit the values with the unicode character U+2029. The task is simple; replace the exiting delimiter character with this special one.
If you get the data via BCS you might can change the SQL for a view to do this directly(haven’t tested), or you can employ a custom extensibility program. If doing the latter here’s the code:
using System;
using System.Xml;

namespace mAdcOW.MultiValue
{
  class Program
  {
    static int Main(string[] args)
    {
      try
      {
        XmlDocument doc = new XmlDocument();
        doc.Load(args[0]);
        foreach (XmlNode node in doc.SelectNodes("Document/CrawledProperty[@varType='31']"))
        {
          // here you can add replacement for other characters
          // as well besides comma
          node.InnerText = node.InnerText.Replace(',', '\u2029');
        }
        doc.Save(args[1]);

      }
      catch (Exception e)
      {
        Console.WriteLine("Failed: " + e.Message + "/" + e.StackTrace);
        return 1;
      }
      return 0;
    }
  }
}

Thursday, June 21, 2012

Why more people should blog (or My bad day hunting down an error with FS4SP)

Today has been one of those days where you feel you haven’t done anything productive, thinking you have tried all tricks in the book to fix some weird error to no avail.

And just now the solution came to me after spending some time with my family and letting my brain work it’s magic without my focus. And I’m just about 100% sure it will work when I test it tomorrow morning.

The short version

Always use mklink /J when moving a folder from within your FAST installation to another volume (and blog about any error you encounter for others to read).

Wednesday, June 13, 2012

Adding prefix logic to the ribbon search box

A common scenario when upgrading from SharePoint search to FAST Search for SharePoint is that you want to run the new search solution side by side with the old until you are comfortable switching.
image
One solution is having two search centers which targets the old and the new index. In my experience end-users find it cumbersome to navigate to the new search center in order to do testing because they want to use the search box in the ribbon as the entry point to the search center. The chosen solution for this post is to allow users to enter a prefix character in the search box to opt-in to use the new search engine.

Saturday, June 9, 2012

Using PowerShell in a .NET installer for a SharePoint App

powershell_2This is not a post about how to invoke PowerShell from within .NET or why you should do it. It is a post about second guessing why you write code the way you do.

At Puzzlepart we have created a time tracking application and we have an .exe installer to provision a site, and create all lists and content types needed. Some weeks ago we decided to have the installer deploy the WSP as well, and not only to post-deploy work.