This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Replace existing file

Hey, 

I am developing a VAF that I would like to replace an existing file with a new file. I am using the below code but I am having some issues. 

I firstly Check out the existing document (ReplacePDF) I am calling GetFilesForModificationInEventHandler, then calling ReplaceFiles and finally Check in the document. 

The file newObjectSourceFiles is the new file that I want to replace. 

var newObjVer = env.Vault.ObjectOperations.CheckOut(ReplacePDF.ObjVer.ObjID);
env.Vault.ObjectFileOperations.GetFilesForModificationInEventHandler(newObjVer.ObjVer);

env.ObjVerEx.ReplaceFiles(newObjectSourceFiles);
env.Vault.ObjectOperations.CheckIn(newObjVer.ObjVer);

Thank you