Archive for category: Deep Dive

SPC14: Refactoring Business Solutions into Apps for Office

02 Mar 2014
March 2, 2014

This session will focus in deep detail on one top 10 business scenario and showcase how it can be enabled with apps for Office. We will review the business scenario, the architectural considerations to enable this scenario in Windows Azure and apps for Office, as well as delving into the code behind the solution. Expect to see a lot and have experts available to you to answer any of your questions and concerns.

Another pre-conf session “Refactoring Business Solutions into Apps for Office” by Richard diZerega, Kirk Evans and Sonya Koptyev.

Here are my notes:

Overview

Richard showed the options you have to deploy apps in a corporate environment – from cloud to corporate marketplace – and showed the different types of Office Apps – from Word to Excel.

20140302_220146928_iOS

When you use copy & paste something to Outlook – it’s a good candidate for a Mail App.

20140302_220853244_iOS

Demo

Richard created a Word App that triggers on a selection and can replace the selection with a link.

20140302_224536861_iOS

He showed that in order to publish an Office App Project you basically need to publish twice. One time for the service (e.g. hosted on azure) and the second time for the App Manifest (xml file) where you tell Office how to reach the service and what type of office app it is.

Binding

So that was a new thing to me – you can create bindings (subscriptions) to lets say a table – then if a condition changes my table gets updated automatically. Read more here.

Mail App

Kirk showed a Mail App and plenty of options how to get known entities out of emails – discovery of element inside an email (addresses, phone numbers and more) – good stuff.

20140303_005018025_iOS

20140303_005104277_iOS

Call to Action

20140303_010315882_iOS

Kirk said there is more to come and more to announced during this SPC.

Summary

Excel App & Mail App – would love to try that at a client but most of them are still on Office 2010. This session gave me a very good understanding what is possible and what not. Really liked the session, when Richard & Kirk present it always looks so easy Smiley

SharePoint 2013 Search Preview for Documents hosted in SharePoint 2010

22 Nov 2013
November 22, 2013

Recently I talked to some clients because of a “Search-First” SharePoint 2013 migration (more about this topic will follow). During a training this week I got aware of a serious issue with the “Search-first” approach, especially with the really nice Office Web Apps 2013 Search Previews you get for free (read only!).

Problem

Some clients want to start their migration with setting up a new SharePoint 2013 farm. This new farm then crawls the old SharePoint 2010 farm. After successfully crawling it, the SharePoint 2013 farm then publishes its Search Service to the SharePoint 2010 farm. So far so good. But what happens with all the new shiny features in the Search UI? Nothing. Until now everything works as it should – you now get better search results in your existing SharePoint 2010 environment.

Now let’s take it a step further. Replace the SharePoint 2010 Search Center with a Search Center hosted in SharePoint 2013 – replacing is actually wrong, you have to do a redirect from the SharePoint 2010 environment to the Search Center in SharePoint 2013 – with the Search Preview, Display Templates and all the good stuff. Pretty great, I totally love the new features and the business value you can create with it:

SharePoint 2013 Preview of PowerPoint document hosted in SharePoint 2013

SharePoint 2013 Preview of PowerPoint document hosted in SharePoint 2013

But here is the Problem: You crawled the SharePoint 2010 environment – by default you wont get a Preview for documents in the old environment:

Preview of a document hosted in SharePoint 2010

Preview of a document hosted in SharePoint 2010

There is a great article by Murad Sæter how you could substitute the Preview with Office Web Apps 2010 (the service application in SharePoint 2010 that needs expensive Office 2010 licenses!). Many of my clients don’t have the Office 2010 licenses – many of them still use Office 2007 – so a show stopper. PDF Preview with old Office Web Apps – nope. This additionally applies to documents hosted on a fileshare – that does not work either.

Reason

So we have Security Trimming in SharePoint Search – you only see what you are allowed to see. Why is there now Preview?

Thats because of oAuth – or better the inability of SharePoint 2010 to understand and accept oAuth (great explanation here by Kirk Ewans).

Behind the scenes

The following happens when you hover over search result that is suitable for a Preview – let’s name the searching user Max:

  1. The search crawler created a link to render a document in the browser. This link is stored in the property ServerRedirectedURL or ServerRedirectedEmbedURL.
  2. This link points to a SharePoint Page called WopiFrame (e.g. http://sharepoint2013/_layouts/15/WopiFrame.aspx?sourcedoc=/Documents/OSP218.pptx&action=default&DefaultItemOpen=1)
  3. This WopiFrame page knows the url to the bound Office Web Apps Server and redirects the request to it. With three parameters: The sourcedoc of the document to render, an oAuth access token and an oAuth time to live token.
  4. The Office Web Apps server, in order to render the document and deliver it back, needs the document to render – of course. Because we left the original server where Max was authenticated – we don’t have this client context anymore – the request from the Office Web Apps back to the SharePoint 2013 server to get the document is anonymously. But why does the SharePoint delivers our precious document? Thats because of the oAuth access token – SharePoint 2013 can validate it and accepts the request like one Max would actually do.
  5. After some computing and drawing time, the Office Web Apps server delivers the preview back to Max.

Because SharePoint 2010 does not understand and accept anonymously requests (most of the time) – and does not understand oAuth tokens – Office Web Apps 2013 do not render Documents hosted on SharePoint 2010.

 Solution: SharePoint 2013 Search Preview for Documents hosted in SharePoint 2010

Figuring out a solution cost me 4 days “brain time” – thinking about the problem – understand the root cause – analyzing options. And chatting with some really nice guys – more about this later.

In the following picture I show you the flow how the requests go from one server to another:

Flow of the requests to render a document hosted in SharePoint 2010

Flow of the requests to render a document hosted in SharePoint 2010

In order to make this all happen, I created a SharePoint Farm Solution (full trust) that needs to be deployed on the SharePoint 2013 side. This provides two handlers that do the following.

SP2010Redirect.ashx: Accepts the initial user request and generates a url that contains the document that should be rendered (full url), the requesting user (domain login) and a simple hash (prevents tampering with the data – no real security!) – that guy is for step (1) in the flow.

SP2010Preview.ashx: Accepts the request back from the Office Web Apps server with the full url of the document, the user login and the hash. With those three values it can check the integrity of the parameters, download the document of the SharePoint 2010 (or what system you like) and  returns it to the Office Web Apps server. This page handles step (3) to step (6).

Pictures / Video or it did not happen!

 

Working Preview of Document hosted in SharePoint 2010

Working Preview of Document hosted in SharePoint 2010

Flaws of the current implementation /

Room for improvement

The code I am going to share is no production ready code – there are magic, hard-coded values in it. I only demonstrate how I did it. No warranties for what so ever.

So why don’t I use oAuth and the WOPIFrame for all the security stuff? Thats because of wonderful internal classes. Dear Microsoft – please open up so I can implement a secure approach.  If I miss a thing and can actually use oAuth directly – please let me know!

Again in other words: If you can create the hash that is passed along for anti-tampering, the SP2010Preview.ashx will download you every document of the SP2010 (this is serious!!) – in my code I did not implement the security check for the given user anyways 🙂 Neither did I add the display template – but its so easy to change it, you will figure it out.

Grab the demo code here.

Thanks!

I really love the SharePoint community – there are a lot of helpful and awesome guys out there. To quote a few that really helped me figuring out this solution:

 

SharePoint 2013: Federated Search Deep Dive – Twitter

27 Nov 2012
November 27, 2012

SharePoint Search Federation is a really underrated feature if you ask me. You can greatly improve your company’s knowledge management and create a single point of entry to all kind of data. Federation comes into play when you can not crawl the data source (too big or too complex).

With SharePoint 2013 and the very cool query templates you have literally thousand of options (to be honest you had them before but with XSLT its not that much fun) to enhance your search results.

Real Time Twitter Search

Lets do a quick example – how about adding Twitter to your search results and style it a bit?

First off, go to Central Admin and click on your with PowerShell provisioned Search Service Application. On the left menu you can see an entry “Result Sources” with 16 default sources defined by SharePoint, compared to SharePoint 2010 that is 4 times more! Most of the SharePoint sources can not be edited but they give you a clue what the intention of this is.

Step 1: Create the federation

If you want to create a search federation you simply need the OpenSearch link. For the twitter example its http://search.twitter.com/search.atom?q={searchTerms}.

Friendly reminder: Your server needs connection to the internet, at least to that site in order to work…

Step 2: Upload a new page layout

When you edit a search page you might notice that there are only two page layouts available, either you go for two columns and that is not that optimal for “side queries”. Or you change it to Web Part page and have the quick launch on the left side. Best chance to try the new design manager and create a 3 column page layout – too many steps for this article, that’s why you can download my hacked version here. Just drop the file SearchWithFederated (right click and save as!) to \\sharepoint2013\_catalogs\masterpage\ (replace sharepoint2013 with the hostname of your server or drop the file to the 15’ folder) – SharePoint 2013 will handle all the rest <— SO COOL!!!

After uploading the page layout, go to site settings of the search center and click on “Page Layouts and Site Templates” and add “SearchWithFederated” to the allowed page layouts:

SharePoint 2013 - allowed page layouts

Then create a page and e.g. call it social.aspx with the new page layout “SearchWithFederated”. The page should look like this now (except that you don’t have the cool logo!):

SharePoint 2013 - 3 colum page layout

Step 3: Add an additional search Web Part to the new zone

In SharePoint 2010 there was a “federated search Web Part” – its gone, you don’t need it anymore. You could do cool stuff with it, at Alegri we have a federation to Microsoft Dynamic where the employees skills and certificates and stuff are managed, on the screenshot you can see it on the right:

Federated search in SharePoint 2010

With SharePoint 2013 they built a lot of new search Web Parts and broke with a lot of old stuff – shiny new world! Okay back to the example, just add:

  1. Refiner Web Part to zone 1
  2. Search result Web Part to zone 2
  3. Search navigation Web Part to zone 2
  4. Search box Web Part to zone 2
  5. Search result Web Part to zone 3

SP2013 Federated Search Column

Step 4: Configure everything

Okay, lets start with the search box, that took me a while to notice that you change the connection here:

  1. Send Queries to Web Parts
    • Search results [1] (check)
    • Search results [2] (check)

Now edit Search Results [2]:

  1. Click on change query (cool new wizard, love it!)
    • Basics
      • Select a query: Twitter
      • Number of results per page: 5
      • Show advanced link: (uncheck)
      • Show result count: (uncheck)
      • Show paging: (uncheck)
      • Show preferences link: (uncheck)
    • Settings
      • Loading Behavior: Async option (this loads the results after the main results in zone 2 appears and doesn’t wait on the twitter search service)

Step 5: First results

ooookay… very cool stuff:

sp2013_federatedsearch2

You can click on the results and get redirected to twitter.

Step 6: Adjust the Display Template

So what’s next, we got it working right? Yepp, but how about the author and the date of the tweet? Let’s tackle this with the awesome new display templates – too many steps and it took me a while to figure it out (author is in the xml), just download the file Item_twitter (right click and save as!) and upload it to \\sharepoint13\_catalogs\masterpage\Display Templates\Search (again, replace the hostname)

One thing that really helped me creating the display template was the super debugger in chrome. Just add “debugger;” in the JavaScript part of the template, hit F12 in Chrome to open up the Developer Tools – and you can debug the display template and context object (just hover over it or use the console) – SWEET!

sp2013_DisplayTemplate_debugger

After uploading the display template, edit the page and set the Item Display Template to “Twitter”. The setting is in the Display Template section of the result Web Part.

Final result

And here comes the very last screenshot of this very long blog post – my longest so far!

sp2013_federatedsearch_final

Feedback?

Much appreciated in the comments!

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close