UpdateDocument deletes the actual file


I'm using the latest version of EPiServer Community - 4.0 I have the folling code:

var clone = (Document)currentDocument.Clone();
clone.Body = "test";

After the update, however, the file is deleted from the file system. I see that there is an entry in the UpdateDocument method in the DocumentArchiveFactory class which says "File.Delete(document.PhysicalPath)". Why UpdateDocument deletes the file. Is there something which I've missed? How can I update an existing file without the need to readd it?

Mar 05, 2012 15:42

I found out that FrameworkFactoryBase.UpdateEntity(document) actually updates the document entitiy without deleting the real file. And this fits perfectly in my scenario.

Mar 15, 2012 10:55
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.