AnsweredAssumed Answered

Using the API to move files

Question asked by Tyler Johnson on Oct 14, 2015
Latest reply on Oct 19, 2015 by Tyler Johnson

I have a custom created add-in to handle moving files based on card variables, using the IEdmFolder6.Move method.  99% of the time it works fine, but every once and awhile I'm getting a failed task.  I've finally narrowed down the exact scenario as described below.


If UserA manually moves a file (drag/drop, cut/paste) from FolderA to FolderB and then UserB tries to run the task which would move the file from FolderB to FolderA.  The task fails.  The error generated is "An attempt was made to create a new file or folder with the same name as an existing one."  Which is because we do not allow files with the same name in our vault, but I'm moving a file not creating one...


I've confirmed this only applies to a task (created from the custom addin).  If I do this from a stand alone application the issue does not exist.

Actually, I just tried this again and I must have not tested correctly the first time around because this doesn't work from an external exe either.


Also, oddly, if prior to executing the task UserB browses to FolderA in the vault, then runs the task.  The task runs successfully.  Based on that, it seems as though their needs to be some kind of refresh the task needs to do because that file location isn't getting updated after it's moved by someone else.  But why it only applies to a task/addin and not the stand alone application I don't understand.


I've actually run into this exact issue before but it was with the creation of folders behaving the same way, created on one computer but unseen on another (from the addin's perspective) unless the parent folder was browsed too.  In that case it was solved by using a batchadd which must do some kind of magic.


So I'm not really sure what I'm suppose to do here.