Page 1 of 1

How to save a file on an existing file in pdm? C#

Posted: Mon Jun 27, 2022 10:20 am
by majo
I'm stuck...
I want to copy a file from outside pdm to the vault on an existing file. The destination file is checked out!
Therefore I use the method "AddFile2":

Code: Select all

ExcelFileName = _saveName;
ExcelFilePath = _savePath;
DestinationFolder = (IEdmFolder8)Vault.GetFolderFromPath(_savePath);

DestinationFolder.AddFile2(0, ExcelTemplate, out int addFileStatus, _saveName, (int)EdmAddFlag.EdmAdd_Refresh);
Unfortunately im getting an error like this:

Code: Select all

"E_EDM_NAME_ALREADY_EXISTS: There is already a file with the specified name in this folder."
Any suggestions?

Cheers Mario

Re: How to save a file on an existing file in pdm? C#

Posted: Mon Jun 27, 2022 10:57 am
by JSculley
AddFile is for adding new files to the vault. If you just want to copy over the top of an existing file, use the .NET System.IO.File.Copy function. As long as the file is checked out, it should work.