I have not tested this but I am thinking that using Dispatch, you could...
- Create and Action
- Check "During Add"
- Add a "Check in" command
- Set the Folder that it is checked in to to the same as a variable.
Let me know if this works.
I was thinking the same thing but am still having no luck getting it to work correctly. Attached is my Dispatch settings check them out and let me know what you think.
Also, I think something has changed in my PDM settings and I haven't found a way to fix it. If I drag a file into PDM once the file is added it shows that it is checked out by me. I'm pretty sure yesterday morning that wasn't the case. I think the file would be there but not checked in/out. Is there a setting somewhere I'm missing?
Dispatch Settings.jpg 70.1 KB
I haven't tried to do anything with dispatch so I can't help with that.
In order to "Move" files within EPDM you must have "delete" permissions (at least on the folder your moving files from). Under the covers a file move is really first copied to the new folder then the it's deleted from the original folder.
Please forgive me if you are already aware of this.
I have tested this now. What I noticed is that for some reason, I cannot check the file in. Have you tried to use copy and delete to move the file?
- Create an Action that does something to the file "During Add"
- Copy the file (to a new location)
- Delete the old file.
I think this would work without a check in.
I've tried a couple other things since my first post. I've removed everything and started over. I can't get it to even check-in a file, using Dispatch. Might be time to call tech support.
One thing that I have noticed is that in Dispatch, I cannot put any "special" characters. For example, periods, backslashes. I have to create a variable called Period and put a string value of . . Likewise with a backslash.
I'm making progress I was able to just check the file in using Dispatch. Lets see what I can do from here now.
Justin, I didn't have you use variables for " . " or " \ "
I'll be honest, I haven't touched Dispatch since I was introduced to it in Joy's advanced Enterprise training class. In my humble opinion, I have more control and can do more than Dispatch offers. Think of Dispatch as a layer on top of the API; therefore, you are limited to whatever Dispatch uses in the API.
So, I'm going to offer an API approach to your problem. This will be pseudocode only and you will need to fill in the details and obvious gaps. Yes, there will be errors, missing pieces, and lack of error handling but this will get you heading in the right direction.
Public Sub GetAddInInfo()
Public Sub OnCmd()
Dim vault As EdmVault5 = CType(poCmd.mpoVault, EdmVault5)
Dim folder As IEdmFolder = Nothing
Dim file As IEdmFile5 = Nothing
Select Case poCmd.meCmdType
file = vault.GetFileFromPath(cmdData(i).mbsStrData1, folder)
If (IsTestFolder(folder.ID)) Then
'You must have delete rights if moving file from one location to another in vault using IEdmBatchAdd
If (folder.HasRightsEx(EdmLib.EdmRightsFlags.EdmRight_Delete, file.ID)) Then
If (Me.LockFile()) Then
Dim projNum As String = Me.GetProjectNumber(file)
If Not (projNum = String.Empty) then
'Move file performed here.
Me.MoveFile(vault, file.ID, folder.ID, poCmd.mlParentWnd)
'Check file in after moving it.
file.UnlockFile(poCmd.mlParentWnd, "Moved file to proper project folder.")
Private Function IsTestFolder(folderID) As Boolean
'BLAH BLAH BLAH....
'I would test for this for added assurance.
Private Function LockFile() As Boolean
Dim status As Boolean = False
If Not (file.IsLocked) Then
status = True
status = True
Private function GetProjectNumber(file) As String
Dim eVar As IEdmEnumeratorVariable = variable = CType(file.GetEnumeratorVariable(), IEdmEnumeratorVariable6)
Dim result As String = Nothing
Dim value As Object = Nothing
If (eVar.GetVar("Project#", "", value)) Then
result = value.ToString()
result = String.Empty
Private Function MoveFile(vault, FileID, FolderID, windowID) As Boolean
Dim batch As IEdmBatch = CType(vault, IEdmVault7).CreateUtility(EdmUtil_BatchAdd)
Dim IArg As Long = 0
Dim filesAdded() As EdmFileInfo = Nothing
batch.AddFileFromVaultToPath(FileID, FolderID, GetDestinationPath(), IArg, "", EdmAdd_DeleteSource)
batch.CommitAdd(WindowID, filesAdded, 0)
Private Function GetDestinationPath(SourceFolderPath, ProjectNumber) As String
Application Engineer (PDM and API Specialist)