Azure / Office 365 / SharePoint Development / Search

Three useful managed properties for working with Office Web Apps

March 18, 2015

When working in Office 365 / SharePoint on-premises you probably already used Office Web Apps (OWA) to create or modify your documents. The power of OWA is also leveraged inside a SharePoint Search Center to show the content of the document inside the hover panel.

Document preview

Document preview

 

This kind of functionality is very helpful for finding the document you are searching for. You can also leverage the OWA functionality inside your own display templates by making use of the following managed properties:

  • ServerRedirectedURL
  • ServerRedirectedPreviewURL
  • ServerRedirectedEmbedURL

Each property has its own purpose. In the next sections I will explain them one by one.

ServerRedirectedURL managed property

The ServerRedirectedURL managed property provides you a link which opens the document in OWA. You can use this managed property if you want your users to open the documents in OWA instead of their client applications.

Sample managed property value: https://tenant.sharepoint.com/sites/Operations/_layouts/WopiFrame.aspx?sourcedoc={9AF85718-3C5A-4FEC-9777-BBE609E610EC}&file=New%20Training%20Programs.pptx&action=default&DefaultItemOpen=1

Usage: You can use this managed property value inside an anchor tag.

Link to the document in OWA

Link to the document in OWA

 

ServerRedirectedPreviewURL managed property

The ServerRedirectedPreviewURL managed property can be used to add a preview image next to the content of the document like in your SharePoint Search Center.

Search result with preview image

Search result with preview image

 

Sample managed property value: https://tenant.sharepoint.com/sites/Operations/_layouts/WopiFrame.aspx?sourcedoc={9af85718-3c5a-4fec-9777-bbe609e610ec}&action=imagepreview

Usage: You can use this managed property value as the source attribute of an image tag.

Preview image example

Preview image example

 

ServerRedirectedEmbedURL managed property

The ServerRedirectedEmbedURL managed property is the property that is used to render the WOPI frame inside the hover panels.

Sample managed property value: https://tenant.sharepoint.com/sites/Operations/_layouts/WopiFrame.aspx?sourcedoc={9af85718-3c5a-4fec-9777-bbe609e610ec}&action=interactivepreview

Usage: You can use this managed property value as the source attribute inside an iFrame.

Document preview

Document preview

 

Adding these properties in your template

You need to add these managed properties to the ManagedPropertyMapping attribute inside the display template before you can start using them in your display templates.

On my GitHub repository you can find a sample display template with these properties: item display template with OWA properties.

Comments

  • Stephen Davidson

    I have added the ManagedPropertyMapping but the ServerRedirectedURL remains blank? Does this need to be modified in the schema?

  • Saav

    Just what I needed. Thanks Elio!