Saturday, May 14, 2011

Document Thumbnails and PowerPoint Preview for your search results without installing FAST for SharePoint

Microsoft offers three different flavors of search for SharePoint 2010: Foundation, Standard and Enterprise. For each level upwards you get more feature and better search capabilities. One of the visual features included with FAST for SharePoint is Thumbnails and Previews for the search results, as listed on the comparison table below (Compare SharePoint Editions – Search).

Wouldn’t it be nice to have this feature on all versions of SharePoint? I will tell you how, as I demonstrated in a proof of concept talk at Arctic SharePoint Challenge 2011.

[Update June 7th 2011 - Check out Thumbnail Extender for SharePoint on CodePlex for a thumbnail webpart using OWA]


The Thumbnail and Preview feature is depending on Office Web Apps, which is an additional module you can install on all versions of SharePoint 2010 in order to get web based editing capabilities of Office documents (Word, Excel, PowerPoint and OneNote). Office Web Apps itself is free, but requires Volume Licensing for Microsoft Office 2010.

The API’s used for generating the thumbnails and the PowerPoint previews are the Office Mobile PowerPoint Web Handler Protocol and the Office Mobile Word Web Handler Protocol, both included with Office Web Apps. These API’s include functions to retrieve generated images of the documents as well as functions to retrieve the textual content within the documents. The API works for doc, docx, ppt and pptx files (Office 97-2010 formats).

The Word API is limited to generating a thumbnail for the first page in your document, while the PowerPoint API can generate an image of any slide as seen below.

If you have installed the Enterprise version of SharePoint you have the possibility to create a new Search Center based on the “FAST Search Center” template, even though FAST is not installed.

The FAST Search Center template features XSLT in the Core Results Web Part which renders javascript calls to functions in a file called search.js located in the _layouts folder. Search.js further implements the communication with the mobile API’s to generate the images.

There are quite a few lines of javascript to implement this feature, but if you are a bit experienced with javascript and ajax programming you would be able to program this feature yourself. This will allow you to get thumbnails and PowerPoint previews with any version of SharePoint, from the free Foundation version to the Enterprise version.

If you are less handy with javascript you can copy out the XSLT used in the Core Results WebPart in the FAST Search Center site template, modify it some, and use it with a search site based on the “Enterprise Search Center” template instead. This way you will get additional visual improvements to the standard search page without having to install FAST.

The quick way is to replace some of the xsl:params set by the web part with pre-set variables instead. If you have FAST installed, then the parameters will be set via the Core Results Webpart. As we are using the oob search we have to set these parameters as variables instead.
<xsl:variable name="OpenPreviewLink" select="'Preview'" />
<xsl:variable name="ClosePreviewLink" select="'Close Preview'" />
<xsl:variable name="ThumbnailTooltipLoadingFailed" select="'Loading failed!'" />
<xsl:variable name="ThumbnailTooltipLoading" select="'Click to toggle preview'" />
<xsl:variable name="AAMZone" select="0" />
<xsl:variable name="PreviewWindowSize" select="160" />
<xsl:variable name="EnableDocumentPreviewPowerPoint" select="'true'" />
<xsl:variable name="EnableDocumentPreviewWord" select="'true'" />
<xsl:variable name="ConcurrentDocumentPreview" select="10" />
<xsl:variable name="TotalDocumentPreview" select="10" />

I also had to modify the xslt two more places. Around line 665 and line 725 locate the FST_CheckForPreview call and change the function parameter

'<xsl:value-of select="sitename"/>'


'<xsl:value-of disable-output-escaping="yes" select="substring-before(serverredirectedurl,'/_layouts/')"/>'

where rootsite is the name of your SharePoint server url.

This was to ensure the calls to the Mobile API went to the top level site, as they failed when called on sub-site url’s.

That being said, there are several other good reasons for deploying FAST for SharePoint in your organization besides these visual enhancements. Capabilities to enrich and modify your content prior to indexing, thus tailoring search experience towards the real needs of your users, as well as the powerful query capabilities offered via FAST Query Language are just a couple of arguments for choosing FAST.

But then again, it never hurts to have moderate amounts of eye-candy on your search page, as it will increase the perceived quality of the results.


  1. Done the modifications but I could not get it working. Some meta data mapping to be done ?
    Can we get some walk through ?

  2. Hey have hard time to get it working ....
    Can we please get some step by step guide ?

  3. Could you elaborate on your server scenario, that might help for debugging purposes.

    But some steps:

    1. Install Office Web Apps and make sure you can view Word and PowerPoint files in it. (If you install it on a test machine with a domain controller, you will have issues as Office Web Apps is not very friendly on a machine which also is a domain controller).

    2. Create an enterprise search center

    3. Edit the core results web part and use my modified xslt from:

    4. Replace http://test with your server in the xslt

    That's basically it.

  4. Does it work for external file shares crawled too?

  5. Andy, unfortunately not. The feature is only available for content residing in SharePoint.

  6. Mikael, Awee ....I would try changing the xslt to make it work for file shares.....
    Thank you for this nice article. I wish you would post more on "SharePoint 2010 Enterprise search" specially the "look and feel" of coresearch webpart/ranking/ custom indexing connectors .. really eager to get my feet on them with your help....

  7. @Andy, I'd be happy to share something on extending the results. Any particular connector or ranking you are thinking about?

    Do you need ranking based on different user groups, or ranking on some special property, or maybe both?

  8. Hi Mikael,

    Great post. I tried to implement your solution and I am getting the following error on the search results page when searching through the site created using FAST Search Template.

    The search request was unable to connect to the Search Service.

    My search results worked fine with Enterprise Search Center site template. Please suggest.

  9. You should use the Enterprise Search Center template, then replace the xslt in the core results webpart with my modifed one (which is from the FAST template)

  10. Hey,
    ranking based on both user groups and special properties... lets say SP2010 crawls all the file shares... I would wanna them to be grouped ( say ..maths, physics, chemistry etc) dynamically where I do not have (group field)a meta data property for them. Can we do that ?
    And also I would wanna learn the BCS Custom Indexing connector where it crawls all my file shares in various Domain Computers.
    Thanks in Advance !!!

  11. As for the BCS filetraverser example from codeplex I haven't had time to try it out myself yet, but I am thinking of adding a chapter about creating a BCS connector with security in my upcoming book on FS4SP for Microsoft Press.

    BCS is not FAST specific, but certainly useful when indexing content from external sources.

    As for the automatic tagging of documents, this is certainly possible with a custom pipeline module. Check out for information on document classification.

    A simple approach would be to scan for certain words and set the category based on that, but you can create much more advanced solutions. You could also use the FAST document vector in your solution.

    Out of the box you can create site/document promotions based on any property you have in the person profile. But with custom code you could create much more advanced ranking.

    One scenario I'm working on is when a search is executed you boost on the following:

    1. Add say 1000 points to documents produced by someone in your department
    2. Add 500 points to your parent department/boss, or any sibling department
    3. Add 700 to any child department of the one you are working in.

    This is not out of the box, requires a good organization structure, and some custom FQL and smartness :)

    Of course I don't know if boosting documents produced in "the vicinity" of yourself is the best approach, but it could work.

  12. I pulled down the code you listed in the comments and still can't get the previews working. OWA is definitely working. Basically, I added the code you listed, updated the server name, dropped it in the Core Results and then tried again but it doesn't work. Do you need to run a crawl or something? I wouldn't think so but wanted to check.


  13. John, could you please let me know how your environment looks? I did my poc on a stand-alone enterprise version without a domain controller.

    I'd be happy to replicate and test other environments.

  14. I'm stand-alone SharePoint enterprise on Windows 2008 Standard with a domain controller. Have run the necessary Powershell scripts. As I've said, OWA is definitely working -- it is just the previews aren't showing. I could definitely be doing something wrong. Happy to assist however I can! Feel free to shoot me a message through my blog and I can help however.


  15. John,
    I know domain controllers are a bitch with OWA, but. Two things:

    1. Will it work if you access the search page from a browser outside of the domain controller (I had this issue where IE on the server didn't work, but with a browser from another machine/client it worked)

    2. Can you install Fiddler on the machine where you test the browser from, and see what kind of error you get on the mobile handler calls. They should be easy to spot, ending with ashx.

  16. Mikael,
    I export the Core Enterprise Search result WebPart, into I changed the xslt - put the code of the address, and then replaced http://test with my server name (http://intranet - (on C3SRV300)) in the XSLT. But not work for me. I can send You my file to check. Can You help me? Thanks

  17. I can't see the thumbnail either. I followed all the steps described in this blog. Mine is a sharepoint farm (sharepoint server, dn server , index server installed on 3 different servers) with Fast installed on index server, office webapps on SharePoint server. Am i missing something ? appreciate your help - Manoj

  18. In theory you have done it the correct way. Typically the error could be calling the handlers on the root site all the time, while you should call it on the correct site level.

    This is not implemented it the xslt I wrote.

    In order to debug this you would need to use something like Fiddler on your client machine, and see what requests are going over to the mobile handler.

    I would recommend taking a look at "Thumbnail Extender for SharePoint" which I link to at the bottom of my post, which uses the same OWA API, but handles it in a webpart instead. It does the image creating in elevated code, and might work better in some scenarios.

  19. HI Mikael, Could you please help me with resolving the thumbnail issue with Fast search ? Please let me know if you need more details which can help find the root casue


  20. I always suspected you could do this. That is all kinds of awesome.

  21. Office Web Apps are working, but not getting previews...

    Using fiddler I see the preview call as:


    If I call that directly, I get a Message saying:
    'ERROR:603:WebException - The remote server returned an error: (404) Not Found.'

    Digging further into 404 errors in the IIS and ULS logs, I find this address being called:


    However, the result of this call generates a error pop-up with a correlation ID. The information from the ULS log says:

    Message : Unknown SPRequest error occurred. More information: 0x80070002

    Message : MobileDocHandler: Unknown exception : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) StackTrace: at Microsoft.Office.Web.Common.Log.ShipAssertTag(UInt32 tag, Category category, Boolean condition, String assertMessage)

    Current Version - Enterprise SP1 with the June CU - No FAST

  22. If you call:


    Do you get something back? The xslt I did needs changing to include the correct lib path when executing MobileDocHandler.ashx (in most cases).

    But If you can, use the webpart from instead. It bypasses the wac proxy as it retrieves the image stream server side and serves it up to the client caller vie it's own handler. It also has a webpart for thumbs i document libraries.

  23. Mikael. Great article. Although I could not quite get it to work. I also tried a SharePoint solution called Vizit Essential. It does not use OWA, but has support for more document formats like TIFF, PDF, DWG and others. The nice thing is you don't need to have FAST or OWA using Vizit and it even works on SharePoint Foundation.

  24. Hi,
    If you see at the top of the article I have a reference to which is pretty easy to get to work.

    OWA is an ok alternative imo, if you don't want to shell out for a commercial solution. And there are several commercial solutions out there. BA-Insight, Surfray and Kodak to name three.

    PS! Your comment looks a bit like an Ad to me :)

  25. Mikael,

    When I attempt to call MobileDocHandler on documents that reside is subsites I get an exception: The remote server returned an error: (500) Internal Server Error

    sample call that fails:

    Calls to document libraries at the toplevel sites work as expected. Example:


    Any thoughts or guidance is appreciated.

    Thank you


  26. Hi Dennis,
    Calls to documents on subsites has to be adjusted:


    Including the full site path before _layouts/MobileDocHandler.ashx. This is one of the things I didn't fix in my xslt.

  27. Thank you for responding. That did the trick for my first test scenario.

    I have a more complex scenario where there is a subsite with a document center with multiple levels of folders that I have yet to figure out how to address.

    looks something like:

    http://portalname/subsite/Docs/folder1/folder2/documentname.docx where Docs is based upon document center template.

    I've attempted http://portalname/subsite/Docs/_layouts/MobileDocHandler.ashx?doc=.... I'm now testing in different environment, so other factors may be in play here.

    Thanks again for your response and your original post. there is not a lot of use info on MobileDocHandler.


  28. I recommend taking a look at the project I linked in at the top from codeplex, or the source code for it.

  29. I like to link to the web part but would like to use the XSLT as well. Is there an option to get the Full path to the documnet for a sub site? Right now it just displays the previews for the root of site you replaced HTTP://test with.

  30. Hi Mike,

    I've copied the XSLT you gave and changed the url. Not only do i not see the document previews, but I also don't see any traffic to the Mobile API .ashx file when using fiddler on the server to monitor traffic to the search engine. Any ideas what I may be doing wrong? Thanks

  31. It's all a matter of modifying the xslt to get the full path of the document via for example the url and then setting ' to the full site name, not just the root which I hardcoded for my POC.

    You can for example get the site url from the document url using some xslt string manipulation. That or make sure you have a managed property with the value, and add that to your search result.

  32. Mikael,

    Great Post. Turns out the fix for the URL is easier than you think. It took some time to figure out the best property to use and it was right under our noses. Just need to use the ServerRedirectedUrl and substring-before.

    So replace http://test with <xsl:value-of disable-output-escaping="yes" select="substring-before(serverredirectedurl,'/_layouts/')"/>

    Now as long as Office Web Apps is enabled on the site it will work no matter were the document is located.


  33. Thanks Damien for taking the time to investigate this fully :) I knew it would be easy.

    I have updated by post to reflect this. Might save a few comments here as well.

  34. So does this work if the content is on another farm? Meaning server1 has the code, and it works fine, but creating an additional web app where the crawled content is on server2 do the previews still work?

  35. It will work on all front-ends having OWA (Office Web Apps) installed.

  36. I installed OWA both on the local and the backend farm and thumbnails are showing in both of them.

    When i'm on the local farm i have to use the credentials of the backend farm to be able to view it's thumbnails.

    The backend thumbnails are available only if i remain logged on the backend.

    Is there a way to bypass authentication for the thumbnail preivew ??

  37. Hi,
    Download the webparts I have referenced in my post, as it will proxy the thumbnail calls with elevated rights.

    Makes it easier to work with imo.

  38. Thanks, this info is great!

    Has anyone had a problem with .docx files that contain tables that span pages? I'm seeing behavior where the preview stops at the page containing the table that spans pages.


  39. Hi,
    thanks for the great info on this page. Unfortunately on my site it is still not working, even when i use the substring-before function. Only documents in the root doc-lib are shown in the preview. As long as they are on a subsite i see in Fiddler 'parent.window['DelegateFn_SRB_g_cab561db_3ab4_4141_9b69_df9a26f0f191_2']('ERROR:600:required parameters either missing or invalid');'
    I don't really know why this happens as everything looks quite crystal clear.

    Has anybody an idea why ?

    Many thanks

  40. i have followed all the steps but i did see thumbnail view of ppt and document please help me to resolve this issue

    1. Hi,
      Some questions:
      What kind of authentication are you using in SharePoint?
      Is Office Web Apps working in SharePoint for your documents?
      If you use Fiddler, are you getting 404 or 401 errors on the calls to the wacproxy?

      Mikael Svenson

  41. Hi Mikael,

    In the search results shown above...for eg...If i click the "PowerPoint Thumbnails 101" how to show the save as dialog box to directly download the powerpoint file.I dont want the profile page for the details of it. Please reply how i can be changed in the XSLT of search core results.

    1. Hi,
      Default when clicking the link of a document it will try to open it in the default application (OWA or PowerPoint client). SharePoint does not show a profile page for documents on default.

      What does the page you are seeing look like?

  42. Hi Mikael

    I've just done the modifications to the XSL without errors. So i get a preview for word documents but for some reason i get no preview for pptx files, although all the web apps are installed and i can edit powerpoint files online. I also checked fiddler and got no 401 or 404 to the wacproxy.

    Do you have any idea?
    Thanks for your help!


    1. Hi Tim,
      I would check the calls being made and see what they return as you don't get 401/404's.

      Can you view pptx with OWA (not edit, but view)?

    2. Hi Mikael

      Just want to let you know i got it working. I should have better read your post as i did forget to change the second part of http://test in the XSL... After a minute it worked :)
      Thx and sorry for your time!


    3. Np :) Glad you got it working and can flash off your skills.

  43. This comment has been removed by a blog administrator.

  44. Hi Mikael,
    Is it possible that using same xslt we can show a Thumbnails preview for video file on our search results page.
    If yes could you please guide me for the same.
    Thanks in Advance!!!

    1. Hi,
      That's not possible in the same manner as the thumbs are created by the mobile handler, and I don't think the mobile handler can create thumbs for video.

      Mikael Svenson