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

Programming and macros
User avatar
majo
Posts: 18
Joined: Thu Mar 25, 2021 3:43 am
Answers: 0
Location: Erkelenz, Germany
x 10
x 24

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

Unread post 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
RTFM or ask Mom!
User avatar
JSculley
Posts: 643
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 877

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

Unread post 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.
Post Reply