November Happy Hour will be moved to Thursday December 5th.

UpdateDocument deletes the actual file

Vote:
 

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


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

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?

#57258
Mar 05, 2012 15:42
Vote:
 

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

#57463
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.