6 Replies Latest reply on Apr 7, 2017 12:05 PM by Sean Donnelly

    Getting Latest and Opening from Standalone C# API

    Sean Donnelly

      I am having issues opening a file via stand-alone application in EPDM API. I want to get latest on that pre-determined file and open it.

       

                IEdmVault7 vault2 = null;

                  if (vault1 == null)

                  {

                      vault1 = new EdmVault5();

                  }

                  vault2 = (IEdmVault7)vault1;

       

       

                  if (!vault1.IsLoggedIn)

                  {

                      vault1.LoginAuto("FocalPoint Vault", this.Handle.ToInt32());

                  }

       

       

                  IEdmSearch5 Search = default(IEdmSearch5);

                  Search = (IEdmSearch5)vault2.CreateUtility(EdmUtility.EdmUtil_Search);

       

       

                  Search.FileName = "TemplatesCode.exe";

       

       

                  IEdmSearchResult5 Result = default(IEdmSearchResult5);

                  Result = Search.GetFirstResult();

       

       

                  IEdmFolder5 srcFolder = null;

                  vault2.GetFileFromPath(Result.Path, out srcFolder);

       

       

                  Process.Start(Result.Path);

        • Re: Getting Latest and Opening from Standalone C# API
          Michael Dekoning

          // get the file object

          IEdmFile5 file = vault2.GetFileFromPath(Result.Path, out srcFolder);

          // check out the file

          file.LockFile(srcFolder.ID, 0, (int)EdmLockFlag.EdmLock_Simple);

            • Re: Getting Latest and Opening from Standalone C# API
              Sean Donnelly

              I'm trying to open the file though. What is the proper way? It won't allow me to do Process.Start(Result.Path); any recommendations?

                • Re: Getting Latest and Opening from Standalone C# API
                  Michael Dekoning

                  Depends on what program you have installed on the computer (SolidWorks, eDrawings, ?).

                    • Re: Getting Latest and Opening from Standalone C# API
                      Sean Donnelly

                      I'm trying to call an existing .exe program file I already have stored in EPDM.

                       

                      For a side note, it would also be helpful to know solidworks and eDrawings if you had a second. But for this instance, I am interested in the .exe file.

                      • Re: Getting Latest and Opening from Standalone C# API
                        Sean Donnelly

                        Any ideas what I'm doing wrong?

                        • Re: Getting Latest and Opening from Standalone C# API
                          Sean Donnelly

                          Figured it out. There are different options for the hyperlink method which can be used in the C# API. see below

                           

                          //Search for all text files in the vault

                                      IEdmSearch5 Search = default(IEdmSearch5);

                                      Search = (IEdmSearch5)vault2.CreateUtility(EdmUtility.EdmUtil_Search);

                           

                           

                                      Search.FileName = "TemplatesCode.exe";

                                      IEdmSearchResult5 Result = default(IEdmSearchResult5);

                                      EdmSelItem2 SelItem = new EdmSelItem2();

                                     

                                      Result = Search.GetFirstResult();

                           

                           

                                      SelItem.mlID = Result.ID;

                                      SelItem.mlParentID = Result.ParentFolderID;

                           

                           

                                      string filepath = "Conisio://" + vault2.Name + "/open?projectid=" + SelItem.mlParentID + "&documentid=" + SelItem.mlID + "&objecttype=1";

                                      if (Result != null)

                                      {

                                          //MessageBox.Show(filepath);

                                          Process.Start(filepath);

                                      }

                           

                           

                          //conisio://ACME1/get?projectid=71&documentid=126&objecttype=1&version=5   - gets a version of the file

                          //Conisio://MyVault/explore?projectid=127&documentid=14&objecttype=1   - browses to specified file

                           

                           

                          //options for the action where above says /get? and /explore?

                          //open          – Open in primary application(such as SOLIDWORKS for .sldprt files)

                          //view           – Opens the file in its “Viewer” application(like eDrawings for .sldprt files)

                          //explore      – Opens an explorer window to the appropriate folder and selects the file

                          //get             – Triggers a "Get" of the file to the local file vault view

                          //lock            – Checks out the file(if the user has adequate permissions to do so)

                          //properties  – Brings up the file properties

                          //history        – Brings up the file history