MS Office write protect after first edit

177 views
Skip to first unread message

Edgar Jung

unread,
Jul 21, 2015, 4:45:25 AM7/21/15
to sabredav...@googlegroups.com
I am using SABRE DAV 3.0.1 with code attached.

1. All the documents are shown perfectely in IE11
2. Open a word document (Word asks to activate EDIT MODE - affirm this)
3. Save Document back to web DAV
4. Open same document again - MS Word shows "write protect"
5. This write-protection stays until registry key with filename is manually deleted: HKEY_USERS\Software\Microsoft\Office\14.0\Word\Security\Trusted Documents\TrustRecords
6. During the action, no lock entry will be written to data/lock (don't know why..)



CODE is:


date_default_timezone_set('Europe/Berlin');
set_include_path($_SERVER['DOCUMENT_ROOT']."/SabreDAV");
require 'vendor/autoload.php';

use Sabre\DAV;
use Sabre\DAV\Auth;

$rootDirectory = new DAV\FS\Directory('public');
$server = new DAV\Server($rootDirectory);
$server->setBaseUri('/dav.php');


$lockBackend = new DAV\Locks\Backend\File('data/lock');
$lockPlugin = new DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);

\Sabre\DAV\Xml\Property\LockDiscovery::$hideLockRoot = true;

$server->addPlugin(new DAV\Browser\Plugin());
$server->exec();

Is there any solution for this behaviour?

@gar


Evert Pot

unread,
Jul 21, 2015, 4:41:53 PM7/21/15
to SabreDAV Discussion, edgar...@elropro.ch
Hi Edgar,

I actually never heard of this behavior. Completely new to me, so as such I'm also not sure what the solution is.
If it's an issue related to locks, the only way to debug this is to get accurate logs from charles http proxy.

If you're willing and interested to dive further into that, set that up and send me the results. Feel free to send it privately if there's information you rather not share.

Cheers,
Evert

Edgar Jung

unread,
Jul 22, 2015, 5:12:28 AM7/22/15
to SabreDAV Discussion
Evert,

attached find dav.log (by charles).

Additional info:

1. Windows 7 
2. IE11
3. Office 2010
4. APACHE 2.2

vhosts setting:

DocumentRoot "c:\develop\webdav"

<Directory "c:\develop\webdav">
   
     Options +Indexes +FollowSymLinks
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
        
RewriteEngine On
RewriteRule ^/(.*)$ /dav.php [L]
RewriteOptions Inherit
AllowOverride All
    
</Directory>

    
ServerName webdav.elro.local:80 
dav.log

Edgar Jung

unread,
Jul 22, 2015, 5:21:01 AM7/22/15
to SabreDAV Discussion
Further more Information:

If I open MS Word and open the document by FILE->OPEN http://webdav.elro.local/dav.php - the document opens perfectely without write protection.

The behaviour about write protection is observed by using the WEB Page Listing ($server->addPlugin(new DAV\Browser\Plugin());) only.

Evert Pot

unread,
Jul 23, 2015, 5:26:38 PM7/23/15
to sabredav...@googlegroups.com
Hi Edgar,

On 2015-07-22 5:21 AM, Edgar Jung wrote:
> Further more Information:
>
> If I open MS Word and open the document by
> FILE->OPEN http://webdav.elro.local/dav.php - the document opens
> perfectely without write protection.
>
> The behaviour about write protection is observed by using the WEB Page
> Listing ($server->addPlugin(new DAV\Browser\Plugin());) only.
>

That's a very interesting observation. In an ideal world it would be
awesome to have two logs side-by-side, one with and one without the
browser plugin. Perhaps based on the difference we can figure out how to
get things to work with the browser plugin as well.

However, there's a lot of errors in your charles log. It appears that
there's some issues in your configuration regarding how the server is
set up.

A few notes:

1. Either use rewriting or don't use it at all. If you use rewriting,
you should rewrite *every* request to your dav.php and make sure that
the baseUri is set to '/'.
2. There's also references to index.php. Make sure that your server
script does not have an index.php file.

There's a few more notes here:

http://sabre.io/dav/baseuri/

If you have that setup correctly, at the very least we can eliminate
that your problem is related to this.

If the problem persist after that, I would be curious:

1. If it still only works if the browser plugin is disabled.
2. If that's the case, if I could get two separate logs from you,
demonstrating this difference.

With that information I'm confident I can figure out what Office wants
and prepare a workaround.

Thanks very much so far!

Cheers,
Evert

Martin Buchan

unread,
Sep 24, 2015, 12:39:03 PM9/24/15
to SabreDAV Discussion, m...@evertpot.com
I am experiencing the exact same behaviour. 

If I open a file directly in Word using File -> Open and pasting in a web dav link to a document (e.g. http://server/test.docx), Word will open the file in read/write mode and I can see a lock generated in the sqlite DB. However, if I open a link by clicking on it from the browser (using Firefox and selecting "open with word") then it will open it in read only mode - and no lock is generated in the sqlite DB.

Did you get any further with this?

cheers
Martin
Reply all
Reply to author
Forward
0 new messages