Visio Viewer / SharePoint 2016 Workaround


Issue:

In SharePoint 2016 for document libraries that are set to "Open in the client application" Visio documents will do nothing when clicked on or show the Windows Store popup window, if the Visio rich client is not installed.

 

Details:

The Visio Viewer is installed with Microsoft Office, ideally the Visio Viewer would show the file or the web Visio Viewer would show the file.  If the web viewer were to be used, it would require a change to the SharePoint code.  SharePoint JavaScript code has no way of telling if Visio is installed or not due to web browser security, so their only option would be to open all Visio files in the web viewer, not honoring the document library setting for users that do have the Visio rich client installed who want Visio to start when the files are clicked on in the SharePoint UI.

 

This use to work, what happened? 

Office, SharePoint and Internet Explorer have been evolving, they are moving away from using the Office IE add-ins to using a protocol handler technology.  Modern browsers do not support old style add-ins, but protocol handlers will work in all modern browsers and IE.  The SharePoint code now uses protocol handlers instead of browser add-ins to open files, see links below for more information:

https://developer.mozilla.org/en-US/docs/Web-based_protocol_handlers

https://msdn.microsoft.com/en-us/library/office/Dn906146.aspx?f=255&MSPPError=-2147217396

 

Workaround:

**Warning, this is sample code, use at your own risk, there are no guarantees or warranties of any kind**

This blog post contains a sample program that will create a protocol handler for the Visio Viewer that ships with Microsoft Office.

The Visual Studio solution can be found here: VisioHandlerSolution.

You can find the VisioHandler.exe program under the VisioHandler\VisioHandler\bin\Debug folder.

VisioHandler.exe needs to be deployed to this exact folder: C:\Program Files\VisioViewerHandler

One time setup is needed to configure the registry to hookup the protocol handler, this command needs to be ran with administrator privileges:

VisioHandler.exe install

The above command will check to see if the protocol handler already exists, if it does exist the command will do nothing.  This insures that if the Visio rich client is installed, none of its settings will be overwritten.

After the file has been deployed and the "install" command ran, all should be working.  Go to a SharePoint 2016 document library and try to open a Visio document, IE will download the file and open it using the Visio viewer.

The code could be modified to use the Visio web viewer, simply change the call to ShellExecute to call VisioWebAccess.aspx instead, see sample below:

http://sp2016ocsi/_layouts/15/VisioWebAccess/VisioWebAccess.aspx?id=/Shared%20Documents/warrenr/Drawing1.vsdx


Comments (2)

  1. Visio Viewer / SharePoint 2016 Workaround with Microsoft works and Microsoft excel and powerpoint viewer.

  2. Hi,

    It seems that as the VisioHandler.exe is not digitally signed by Microsoft, that the Smartscreen filter stops the .exe from running. Can you fix this please? Also, can you please update the VisioHandler and ProjectHelper solutions so you do not need to use %AppData% and instead point them to C:\Program Files or other directories, as the executables for viewers are not located in %AppData%. For example, for MS Project, we would like to launch Seavus Project Viewer to open MPP files. Also, is there a plan at Microsoft to integrate into the protocolhandler.exe for Office 2016 Pro Plus C2R to enable it to handle opening Visio Viewer and/or Seavus Project Viewer when a file is opened from SPO? The way things work now is not a great user experience, unless SPO is defaulted to opening with the Office Online viewers instead of open in the client app, which we don’t really want to change on the SPO tenant site collections or by per document library.

Skip to main content