AnsweredAssumed Answered

File is not checked out by you in PreAdd hook

Question asked by Juan Portugal on Jul 18, 2018
Latest reply on Jul 18, 2018 by 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)

            poCmdMgr.AddHook(EdmCmdType.EdmCmd_PreAdd);

        }

 

 

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"));

                varManager.CloseFile(true);

            }

            break;

    }

}

 

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

 

Thanks so much

Outcomes