1 Reply Latest reply on Jul 18, 2018 12:56 PM by Juan Portugal

    File is not checked out by you in PreAdd hook

    Juan Portugal

      Hello, I am working on an Add-in that must modify a variable when the documents are added to the vault, the problem, is that both, PreAdd and PostAdd return me an error that the document was not checked out by me (0x080040210), obviously, the files have not been registered yet


      This is my code


      public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)


                  poInfo.mbsAddInName = "Titulo C# Add-In";

                  poInfo.mbsCompany = "ARTRANS S.A.";

                  poInfo.mbsDescription = "Renombra los títulos de las obras de epdm.";

                  poInfo.mlAddInVersion = 1;

                  poInfo.mlRequiredVersionMajor = 17;

                  poInfo.mlRequiredVersionMinor = 5;

                 //Create PreAdd hook (with PostAdd i have the same result)





      public void OnCmd(ref EdmCmd poCmd, ref Array ppoData)


          switch (poCmd.meCmdType)


              case EdmCmdType.EdmCmd_PreAdd:



                  IEdmVault5 _Vault = (IEdmVault5)poCmd.mpoVault;

                  IEdmFile5 archivo = default(IEdmFile5);

                  var varManager = default(IEdmEnumeratorVariable8);



                  foreach (EdmCmdData fila in ppoData)


                      archivo = (IEdmFile5)_Vault.GetObject(EdmObjectType.EdmObject_File, fila.mlObjectID1);

                      varManager = (IEdmEnumeratorVariable8)archivo.GetEnumeratorVariable();

                      varManager.SetVar("Title", "", "Example"));







      Someone knows how it must be done? i'm really out of ideas!


      Thanks so much

        • Re: File is not checked out by you in PreAdd hook
          Juan Portugal

          I found the documentation about EdmCmdData Structure with the behavior of EdmCmdData Structure on each hook, so, in my case, with PostAdd

          I got

          ID of parent folder in EdmCmdData.mlObjectID1

          Local file path in EdmCmdData.mbsStrData1

          And with the required data i just replace this line:

          archivo = (IEdmFile5)_Vault.GetObject(EdmObjectType.EdmObject_File, fila.mlObjectID1);

          For this

          IEdmFolder5 carpeta = (IEdmFolder5)_Vault.GetObject(EdmObjectType.EdmObject_Folder, fila.mlObjectID1);

          archivo = _Vault.GetFileFromPath(fila.mbsStrData1,out carpeta);