Showing posts with label Office Web Apps 2013. Show all posts
Showing posts with label Office Web Apps 2013. Show all posts

Wednesday, September 23, 2015

Control whether PDFs open in Word Web App or the default PDF reader

Control whether PDFs open in Word Web App or the default PDF reader

When users open a PDF file from a SharePoint document library that uses Office Web Apps Server, the default behavior is to open the PDF in Word Web App. If this isn’t the behavior you want, or if your users are having trouble opening PDFs on smartphones, you can use Windows PowerShell commands to make PDFs open in your default PDF reader instead. Here's how:

Step 1: Open an elevated SharePoint 2013 

Management Shell

On the computer running SharePoint Server 2013 or SharePoint Foundation 2013, open an elevated SharePoint 2013 Management Shell. Choose the procedure that corresponds to your server operating system:
  • In Windows Server 2008 R2:
    1. On the Start menu, select All Programs.
    2. Select Microsoft SharePoint 2013 Products.
    3. Choose (right-click) SharePoint 2013 Management Shell to display the shortcut menu.
    4. From the shortcut menu, choose Run as administrator.
  • In Windows Server 2012:
    1. Swipe in from the edge of the screen to show the charms and then choose Search to see all the applications that are installed on the computer.
    2. Choose (right-click) SharePoint 2013 Management Shell to display the app bar.
    3. In the app bar, select Run as administrator.

Step 2: Run the Windows Powershell Command

At the Windows PowerShell prompt, enter one of the following commands, based on what you want to do:
    • To adjust the binding so that smartphones won’t try to view PDFs in Word Web App (but other devices will continue to), enter the following command and then press Enter:
      Get-SPWopiBinding -Action "MobileView" -Application "WordPDF" | Remove-SPWopiBinding -Confirm:$false
    • To remove the binding altogether so that PDFs open in the default PDF viewer on all devices, use the following:
      Get-SPWOPIBinding –Application "WordPDF" | Remove-SPWOPIBinding -Confirm:$false

Going back

If you change your mind and later want to have PDFs open in Word Web App again, follow the same procedure as above, but in Step 2, run these two commands:
Get-SPWOPIBinding –Application "WordPDF" | Remove-SPWOPIBinding -Confirm:$false
New-SPWOPIBinding –ServerName "" –Application "WordPDF" -AllowHTTP
Be sure to use your own Office Web Apps server name instead of “”

Hope this help,

Friday, August 7, 2015

Office Web Apps not working for Content Search Web Part

Office Web Apps  not working for Content Search Web Part

Observation with Content Search WebPart.

The Office Web Apps Server opens the documents in Browser from the AllItems.aspx as well as the Search Results Page. But when I try opening from a content Search WebPart, it is not able to open in the Browser.

To enable Office Web Apps for search content web part, we should modify the url in the display template.

I have tried to replicate the behaviour from search webparts and added the following code from search display templates so that it supports OWA. Below is the code.

<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<title>AdSpace Picture on top, 3 lines on bottom</title>

<!--[if gte mso 9]><xml>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:ManagedPropertyMapping msdt:dt="string">&#39;Picture URL&#39;{Picture URL}:&#39;PublishingImage;PictureURL;PictureThumbnailURL&#39;,&#39;Link URL&#39;{Link URL}:&#39;Path&#39;,&#39;Line 1&#39;{Line 1}:&#39;Title&#39;,&#39;Line 2&#39;{Line 2}:&#39;Description&#39;,&#39;Line 3&#39;{Line 3}:&#39;&#39;,&#39;FileExtension&#39;,&#39;SecondaryFileExtension&#39;,&#39;ContentTypeId&#39;,&#39;ServerRedirectedURL&#39;</mso:ManagedPropertyMapping>
<mso:MasterPageDescription msdt:dt="string">This Item Display Template will show a 304x100 picture of the item on top. The title and the default item description will display to the bottom of the picture with an additional line that is available for a custom managed property.</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
<mso:TargetControlType msdt:dt="string">;#Content Web Parts;#</mso:TargetControlType>
<mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
<mso:_dlc_DocId msdt:dt="string">ZRMVMDDDEAE7-1-215</mso:_dlc_DocId>
<mso:_dlc_DocIdItemGuid msdt:dt="string">583b0835-32ff-4d1c-983f-b6ff4a0ef956</mso:_dlc_DocIdItemGuid>
<mso:_dlc_DocIdUrl msdt:dt="string">http://sp2013-dev-6:7000/sites/adspace/_layouts/15/DocIdRedir.aspx?ID=ZRMVMDDDEAE7-1-215, ZRMVMDDDEAE7-1-215</mso:_dlc_DocIdUrl>
<mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded>
<mso:HtmlDesignStatusAndPreview msdt:dt="string">http://sp2013-dev-6:7000/sites/adspace/_catalogs/masterpage/Display Templates/Content Web Parts/Item_PictureOnTop.html, Conversion successful.</mso:HtmlDesignStatusAndPreview>


            Warning: Do not try to add HTML to this section. Only the contents of the first <div>
            inside the <body> tag will be used while executing Display Template code. Any HTML that
            you add to this section will NOT become part of your Display Template.
        $includeLanguageScript(this.url, "~sitecollection/_catalogs/masterpage/Display Templates/Language Files/{Locale}/CustomStrings.js");

        Use the div below to author your Display Template. Here are some things to keep in mind:
        * Surround any JavaScript logic as shown below using a "pound underscore" (#_ ... _#) token
        inside a comment.

        * Use the values assigned to your variables using an "underscore pound equals"
        (_#= ... =#_) token.

    <div id="Item_PictureOnTop">

var useWACUrl = !$isEmptyString(ctx.CurrentItem.ServerRedirectedURL);
        if(ctx.ScriptApplicationManager && ctx.ScriptApplicationManager.states){
            useWACUrl = (useWACUrl && !ctx.ScriptApplicationManager.states.openDocumentsInClient);

        var appAttribs = "";
            if (!$isEmptyString(ctx.CurrentItem.csr_OpenApp)) { appAttribs += "openApp=\"" + $htmlEncode(ctx.CurrentItem.csr_OpenApp) + "\"" };
            if (!$isEmptyString(ctx.CurrentItem.csr_OpenControl)) { appAttribs += " openControl=\"" + $htmlEncode(ctx.CurrentItem.csr_OpenControl) + "\"" };
        var url = ctx.CurrentItem.csr_Path;
                url = ctx.CurrentItem.ServerRedirectedURL;
            } else {
                url = ctx.CurrentItem.Path;

var encodedId = $htmlEncode(ctx.ClientControl.get_nextUniqueId() + "_pictureOnTop_");

var linkURL = $getItemValue(ctx, "Link URL");
 var iconURL = Srch.ContentBySearch.getIconSourceFromItem(ctx.CurrentItem);

var line1 = $getItemValue(ctx, "Line 1");
var setLineHeightRenderer = function(valueInfoObj)
    if(!$isNull(valueInfoObj) && !valueInfoObj.isEmpty)
            return valueInfoObj.defaultValueRenderer(valueInfoObj);
            return valueInfoObj.toString();
        return "&nbsp;";
var line2 = $getItemValue(ctx, "Line 2");
var line3 = $getItemValue(ctx, "Line 3");
var pictureURL = $getItemValue(ctx, "Picture URL");
var pictureId = encodedId + "picture";
var pictureMarkup = Srch.ContentBySearch.getPictureMarkup(pictureURL, 304, 100, ctx.CurrentItem, "cbs-pictureOnTopImg", line1, pictureId);

var containerId = encodedId + "container";
var pictureLinkId = encodedId + "pictureLink";
var pictureContainerId = encodedId + "pictureContainer";
var dataContainerId = encodedId + "dataContainer";
var line1LinkId = encodedId + "line1Link";
var line1Id = encodedId + "line1";
var line2Id = encodedId + "line2";
var line3Id = encodedId + "line3";

        <div class="top-content-box" id="_#= containerId =#_" data-displaytemplate="ItemPictureOnTop">
            <div class="top-content-img" id="_#= pictureContainerId =#_">
                <a class="cbs-pictureImgLink" href="_#= $urlHtmlEncode(url) =#_" title="_#= $htmlEncode(line1) =#_" target="_blank" id="_#= pictureLinkId =#_">
                    _#= pictureMarkup =#_
                <h3 id="_#= line1Id =#_"><a class="cbs-pictureOnTopLine1Link" target="_blank" href="_#= $urlHtmlEncode(url) =#_" title="_#= $htmlEncode(line1) =#_" id="_#= line1LinkId =#_"> _#= line1 =#_ </a></h3>     
                <span class="content-date" title="_#= $htmlEncode(line2) =#_" id="_#= line2Id =#_"><img class="cbs-Thumbnail" src="_#= $urlHtmlEncode(iconURL) =#_" alt="_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_" id="_#= pictureId =#_" />_#=line2=#_</span>               

Basically,ctx.CurrentItem.ServerRedirectedURL is calculated by a managed property ServerRedirectedURL which needs to be included in the display template.
Problem solved.

Hope this Help.

Monday, August 3, 2015

Office Web Apps 2013 Server Install and Configuration

Office Web Apps 2013 Server Install and Configuration

Installing Office Web Apps

Office Web Apps 2013 is a stand-alone server web application that provides capabilities to open and render a Microsoft Office Word, Excel, PowerPoint, or OneNote document as a web page. Microsoft SharePoint 2013, Exchange 2013, and Lync 2013 can share the rendering service to display Office documents in those applications as a web page. Additionally, when accessed from within a SharePoint 2013 farm, Office Web Apps also enables rich editing features for those documents.
  1. You cannot install Office Web Apps on the same server as SharePoint 2013
  2.           Office Web Apps cannot be a domain controller

Please follow the server preparation process in the following sections for the appropriate server, either Windows Server 2008 R2 or Windows Server 2012.

Windows Server 2008 R2 Preparation

Start by installing the following prerequisite software for Windows Server 2008 R2:
Open a PowerShell command running as an Administrator and execute the following commands to install the required roles and services for Office Web Apps.
Import-Module ServerManager
## Run the following command as a single line
Add-WindowsFeature Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,Web-Security,Web-Windows-Auth,Web-Filtering,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Console,Ink-Handwriting,IH-Ink-Support
Please continue with the “Office Web Apps Installation” section below.

Windows Server 2012 Preparation

To begin, open a PowerShell command running as an Administrator and execute the following commands to install the required roles and services for Office Web Apps.
Add-WindowsFeature Web-Server,Web-Mgmt-Tools,Web-Mgmt-Console,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Static-Content,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,InkandHandwritingServices
Please continue with the “Office Web Apps Installation” section below.

Office Web Apps Installation

Open and run the Office Web Apps setup.exe media to launch the setup wizard.
  1. In the Office Web Apps Server 2013 Wizard, on the Read the Microsoft Software License Terms page, select I accept the terms of this agreement and then select Continue.
  2. On the Choose a file location page, select the folder where you want the Office Web Apps Server files to be installed (for example, C:\Program Files\Microsoft Office Web Apps), and then select Install Now. Note that, if this folder does not exist, Setup will create it for you.
    The Choose a file location screen on the Office Web Apps install wizard.
    The Choose a file location screen on the Office Web Apps install wizard.
  3. When Setup finishes installing Office Web Apps Server, choose Close.
After installing the Office Web Apps 2013 server software, you are ready to install any additional add-ins and updates. You can also install any language packs your farm requires. To install the language packs, run the setup media for each of the language packs you desire.
If applicable, install the latest service pack Microsoft has released for Office Web Apps 2013 and then apply the latest service packs Microsoft has released for Office Web Apps 2013 language packs.
Finally, check for updates on Microsoft Update in the server’s control panel.

Configuring Office Web Apps

This section describes how to configure an Office Web Apps farm and join servers to it.
Important: Low memory conditions can cause Office document previews to fail in Office Web Apps. Verify that any servers that run Office Web Apps have sufficient memory.
On the first server for the Office Web Apps farm, execute the following PowerShell command to provision the farm:
New-OfficeWebAppsFarm -InternalUrl "" -ExternalUrl "" -SSLOffloaded –EditingEnabled
The SSLOffloaded command switch configures Office Web Apps for hardware load-balancing, where the load-balancing device manages the SSL certificate and then relays the request to an Office Web Apps server over HTTP unencrypted traffic. This improves the overall performance but does require a secure network between the load-balancer and the Office Web Apps servers.
The following image provides an example of the expected output from the PowerShell command.
PowerShell results from configuring an Office Web Apps farm
PowerShell results from configuring an Office Web Apps farm
Critical: Before you can use the Office Web Apps farm, you must add your domain to the list of allowed hosts.
Run the following PowerShell command to add your domain to the list of allowed hosts, substituting your domain for “”
New-OfficeWebAppsHost -Domain
Once you have provisioned an Office Web Apps farm and allowed your domain, you can join additional Office Web Apps servers to the farm. To join additional servers, install the Office Web Apps software by following the steps in the previous section and then execute the following PowerShell command.
New-OfficeWebAppsMachine –MachineToJoin “
You can test the Office Web Apps configuration by navigating to this URL and verifying it displays a Web app Open Platform Interface (WOPI)-discovery XML file:
(replacing with your OWA external domain)
Note: For more information on deploying and configuring Office Web Apps, please see this TechNet article:

Configuring the Windows Firewall for Office Web Apps Traffic

On each Office Web Apps 2013 Server, you will need to set a firewall rule to allow Office Web Apps inter-farm traffic and HTTP/HTTPS traffic. Alternatively, you can disable the Windows Firewall if you choose and if you have another firewall solution.
You can set the Windows Firewall rules by navigating to the Control Panel, then click System and Security, then click Windows Firewall, and finally clickAdvanced settings. In the Inbound Rules area, ensure that the server allows connections on port 80 (HTTP) and port 443 (HTTPS). Add the port for the Office Web Apps inter-farm communication by following these steps:
  1. In the Windows Firewall with Advanced Security window, click Inbound Rules.
  2. In the Actions panel, click New rule…
  3. In the New Inbound Rule Wizard window, select Ports as the Rule Type and click Next.
  4. Select TCP and enter “809” for the Specific local ports. Click Next.
    Windows Firewall Port Rule for Office Web Apps communication
    Windows Firewall Port Rule for Office Web Apps communication
  5. Click Next. On the Profile screen, uncheck Public and click Next.
  6. On the Name screen, enter “Office Web Apps Inter-Farm Communication” and click Finish.

Configuring a SharePoint 2013 Farm for Office Web Apps

Logon to the SharePoint application server that hosts Central Administration and open the SharePoint 2013 Management Shell (PowerShell), running it as an administrator. Next, enter the following PowerShell command:
New-SPWOPIBinding -ServerName “
Run the following PowerShell command to enabled OAuth over HTTP.
$config = (get-spsecuritytokenserviceconfig)
$config.allowoauthoverhttp = $true
Run the following PowerShell command to change the WOPI zone to external-https.
Set-SPWOPIZone –zone “external-https”
Finally, verify that Office Web Apps is working by navigating to a SharePoint 2013 document library and verify that you can open a document as a web page.

How to export a schema.xml file for a list from a SharePoint site

How to export a schema.xml file for a list from a SharePoint site In sharepoint, we can retrieve the XML schema of any list by using ...