MS Excel and Power Point cannot open local hosted file correctly via WebDAV

I am currently doing a project with WebDAV to build some kind of document management system. It is an ASP.NET web application hosted in IIS. (Although it doesn't use IIS WebDAV, but a modification of this project: http://mvc4webdav.codeplex.com/

It has been working fine for the past few months, but a few days ago Excel and PowerPoint are not behaving properly.

I used FFWinplugin or Sharepoint ActiveXObject (OpenDocument Control) depending on the browser.

When the user clicks on a document link, he calls this function:

function editDocument(event, path) {
    event.preventDefault();
    if (fNewDoc) {
        if (!EditDocumentButton.EditDocument(path)) {
            alert(L_EditDocumentRuntimeError_Text);
        }
    } else {
        try {
            //************************ This part works for word but not excel or power point
            //var ffWinPlugin = document.getElementById("winFirefoxPlugin");
            //var ov = ffWinPlugin.GetOfficeVersion();
            // ffWinPlugin.EditDocument(path, ov);
            //*********************************
            window.location.replace('ms-powerpoint:ofe|u|' + path); //But this works for excel and powerpoint 
        } catch (e) {
            alert(L_EditDocumentError_Text);
        }
    }
}

      

fNewDoc

was the flag I set on page load to determine if the OpenDocument control was initialized or not in IE.

The path looks something like this:

http://localhost/appName/EditDocument/cb72e81f-fb9c-40af-962b-aa981b79bb72/Test.pptx

      

The problem is this:

When I try to open an Excel / PowerPoint file by calling the function EditDocument

above using FFWinPlugin or OpenDocument, it doesn't open to edit properly. Both just open without a protected view, but cannot be edited.

  • In Excel, it doesn't show read-only mode, but when I tried to save, it says the document is not saved.
  • In PowerPoint, it opens in read-only mode.

I debugged to see the WebDAV requests that were made and it turns out that both of them request PROPFIND over and over again after the first OPTIONS.

Although, if I use window.location.replace(.....)

, all 3 applications (Word, Excel, PP) open documents perfectly in Protected View and can be edited. In addition, it follows the usual WebDAV request loop (OPTIONS-HEAD-OPTIONS-LOCK-GET-PROPFIND-UNLOCK). If I allow editing it works fine.

I tested the app first on Office 2013 (365) and for backward compatibility I installed Office 2010 (I searched online and afterwards I know it was a bad idea to have them around). And this whole problem comes after I uninstalled the 2010 version.

I tested it on another computer, the problem didn't occur. Tested also in WebDAV online demo and no issues. So it looks like the problem only occurs between Excel / PowerPoint and localhost.

I could just use a working method to fix this, but that would make it inflexible as I would need to have many if-else statements to determine which ms office application to use. Although, if I use FFWinPlugin, I don't need to worry about that. So I really want to know what's going on, but I haven't got anything after searching the internet for a while.

How can I fix this? At first it seemed to me that the Office 2013 installation was corrupted after uninstalling 2010, but it works when not using FFWinplugin. So now I'm not sure what went wrong.

+3


source to share





All Articles