Saving to SharePoint via WebDAV redirector. Getting new object ID and losing version history

StackOverflow https://stackoverflow.com/questions/604332

  •  03-07-2019
  •  | 
  •  

Question

I'm using WebDAV redirector to edit a file on a SharePoint repository. It looks like each time I save the file this way, I get a new object that replaces the previous one. This is causing all the version history to be lost.

Open file is being done via CreateFile with:

filename - Same that is used for Read-Only call to CreateFile (which works)

DesiredAccess: GENERIC_READ | GENERIC_WRITE

dwShareMode: FILE_SHARE_READ SecurityHandle: length is set, but other 2 fields are 0

dwCreationDisposition: OPEN_EXISTING dwFlagsAndAttributes: FILE_ATTRIBUTE_NORMAL

hTemplateFile: NULL

After I write the file to the handle returned by this call, if I get the list item for this file, the object number (ID=) has been incremented. Also, this ID number seems to be prepended to each of the fields in the list item (separated from the actual data by the sequence "#;")

This increment of the ID number (and loss of version history) doesn't happen if I check out, edit, then check in using the web interface; it retains the same ID, and the version history is left intact.

How can I avoid this? I must keep the version history.

Was it helpful?

Solution

I'd recommend to obtain an HTTP trace.

Likely, it will show that the redirector uses a temporary file, and then MOVEs it over the original file.

Fix: use a smarter WebDAV client (Xythos drive may be better).

OTHER TIPS

by using WebDav you are bypassing the SharePoint runtime, which is why you . to ensure that you get the version history you should use the SharePoint apis (web services or OM)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top