1

SharePoint 2013 can be configured to use an Office Web Apps (OWA) server in order to display/preview Microsoft Office documents directly within the browser. This can be seen for example when opening the callout of a document or when clicking the "new document" button.

The question is, how can I programmatically detect if SharePoint is connected to an OWA server? I didn’t find anything public on the SharePoint API.

What I am looking for is something like below methods:

  • Microsoft.SharePoint.Utilities.SPWOPIHost.IsWOPIEnabled(SPWeb web)
  • Microsoft.SharePoint.Administration.SPFileUrlRedirectManager.HasWopiBinding()

However everything I found is internal and I do not want to use any reflection stuff. Does anybody have a clue, if SharePoint provides a public method indicating whether it is connected to an OWA Server?

JFYI – in case you have access to an OWA server, you can link SharePoint to it with following Cmdlet:

New-SPWOPIBinding -ServerName "officewebapps.company.com"

1

You can use the Get-SPWOPIBinding cmdlet that can provide the information resulting from the New-SPWOPIBinding command.

In your example, it would be Get-SPWOPIBinding -Server "officewebapps.company.com"

There is another cmdlet Get-SPWOPIZone that'll give you the list of bindings within the zone. More about it and the Get-SPWOPIBinding command is here in TechNet.

| improve this answer | |
  • The thing is that I want to get this information programmatically (from C# code running within SharePoint) and not via PowerShell. The class behind the Cmdlet you are referring to is SPCmdletGetWOPIBinding (which is internal too). And internally it uses SPFileUrlRedirectManager.HasWopiBinding(). And I would like to be able to do so too.. ;) – PzYon Nov 13 '14 at 17:47
  • are you trying to access the OWA from an external C# app using the WOPI protocol? – Supriyo SB Chatterjee Nov 13 '14 at 18:20
  • No, I am developing a solution within SharePoint and I want to know, if the server is connected to OWA in order to be able to redirect to a correct URL (either open a document via WOPIFrame.aspx [browser] or in the client application [local]). This is just an example, another one would be the simulation of the "new document" button in lists, which needs to be different when OWA is available/link and when it isn't. – PzYon Nov 13 '14 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.