15 Replies Latest reply on Sep 28, 2017 7:49 AM by Richard Lessard

    EPDM Auto-Get API Help

    Joe Wilcoxson

      I am trying to write a bit of code that will batch get library files when needed. I found and modified some code on this forum to do exactly this, but it doesn't seem to work for me. This is on EPDM 2012 SP3. Using Visual Studio 2010, C#. I am getting and invalid arguement exception on bg.AddSelection. Anyone care to take a look at it?



                  EdmVault5 vault = new EdmVault5(); ;


                // Change "My Vault" to your vault name

              vault.LoginAuto("My Vault", 0);


              // Change the number 2 in the following line to match the number of folders

              EdmSelItem[] folders;

              folders = new EdmSelItem[2];


              // The folders array index starts with 0.

              // mlDocId = 0 tells EPDM you want all the files in the folder

              folders[0].mlDocID = 0;

              folders[0].mlProjID = vault.GetFolderFromPath("C:\\My Vault\\Library").ID;

              folders[1].mlDocID = 0;

              folders[1].mlProjID = vault.GetFolderFromPath("C:\\My Vault\\Misc").ID;


               IEdmBatchGet bg;

              bg = vault.CreateUtility(EdmUtility.EdmUtil_BatchGet);

              bg.AddSelection(vault, folders);

              bg.CreateTree(0, 8);

              bg.GetFiles(0, null);


        • Re: EPDM Auto-Get API Help
          Michael Dekoning

          I think all you need to do is convert vault.CreateUtility to the IEdmBatchGet type like so,


                  bg = vault.CreateUtility(EdmUtility.EdmUtil_BatchGet) as IEdmBatchGet;

          • Re: EPDM Auto-Get API Help
            Lee CS Young

            Have you checked that the folder paths are correct when you debug?

            • Re: EPDM Auto-Get API Help
              Nick Stringer

              Joe, did you manage to find a solution in the end? I'm running into the exact same problem now.


              I know it's pretty easy to iterate through each file/folder and do an individual GetFileCopy() for each file, but I'd like to get this working if possible.


              I don't know whether it's related, but I did find it strange that the AddSelection() method actually asks for an IEdmVault5 object, despite the fact that the API guide says it should be IEdmVault5. Additionally, IEdmVault7 is the earliest interface with a CreateUtility() method.

                • Re: EPDM Auto-Get API Help
                  Joe Wilcoxson

                  I did find something that works, when I get in to work today I'll dig up my source code and post it.

                  • Re: EPDM Auto-Get API Help
                    Joe Wilcoxson

                    Here was my solution:


                    EdmVault5 vault = new EdmVault5();


                    //Replace My_Vault with your vault name

                    vault.LoginAuto("My_Vault", 0);


                    //Set the 2 here equal to how many folders you want to get (not counting subfolders)

                    EdmSelItem[] fa = new EdmSelItem[2];

                    IEdmBatchGet bg = (IEdmBatchGet)vault.CreateUtility(EdmUtility.EdmUtil_BatchGet);


                    //Create and array element for eachf older you want to get, replace folder locations with your folders

                    fa[0].mlDocID = 0;

                    fa[0].mlProjID = vault.GetFolderFromPath("C:\\My_Vault\\Misc").ID;

                    fa[1].mlDocID = 0;

                    fa[1].mlProjID = vault.GetFolderFromPath("C:\\My_Vault\\Library").ID;


                    bg.AddSelection((EdmVault5)vault, (System.Array)fa);

                    bg.CreateTree(0, (int)EdmGetCmdFlags.Egcf_SkipExisting);

                    bg.GetFiles(0, null);

                      • Re: EPDM Auto-Get API Help
                        Nick Stringer

                        Nope, still not working... Thanks for posting your code though.


                        Just wondering, which version of EPDM are you using?

                          • Re: EPDM Auto-Get API Help
                            Seth Ruhan

                            Here is another solution,


                            Full implementation with Dialogue box for user etc is attached.


                            Private Function GetLatestFilesInFolders(Paths As List(Of String)) As Boolean

                                    If PingServer(ArchiveVault, MaxPing) < MaxPing Then

                                        Dim bg As IEdmBatchGet = vault12.CreateUtility(EdmUtility.EdmUtil_BatchGet)

                                        Dim sellist As New List(Of EdmSelItem)

                                        Dim esi As New EdmSelItem

                                        esi.mlDocID = 0

                                        Dim EdmFolder As IEdmFolder5 = Nothing

                                        For Each path As String In Paths

                                            EdmFolder = vault12.GetFolderFromPath(path)

                                            If EdmFolder IsNot Nothing Then

                                                esi.mlProjID = EdmFolder.ID


                                            End If


                                        bg.AddSelection(vault12, sellist.ToArray())

                                        bg.CreateTree(0, EdmGetCmdFlags.Egcf_SkipExisting)

                                        bg.GetFiles(0, Nothing)

                                        FderSelect.UpdateDate = DateTime.Now.Date

                                        Return True

                                    End If

                                    Return False

                                End Function


                      • Re: EPDM Auto-Get API Help
                        Brandon Plubell

                        I know this has been marked as answered, but the answer has not seemed to work for everyone (myself included). What I suspected was that the issue was not in the code. I am using C# in Visual Studio and making the assembly COM-visible solved the problem for me (Solution Explorer -> [Project name] -> Properties -> Application tab -> Assembly Information... -> Make assembly COM-Visible).


                        Hopes this helps others.