0 Replies Latest reply on Sep 23, 2016 9:02 AM by Mario Zahren

    Rollback to "Revision:" Event API

    Mario Zahren

      Hello all,

      how to rollback a File in vault to the event "Revision:"? The only thing I can get is the Version but that is unfortunately not the Revision-Entry in the History of the file.

      Here the code I use so far:

       

      public void releaseNativDocInvalid(string EcnNewComment, IEdmFile8 File, IEdmFolder5 ppoRetParentFolder, string configName, IEdmVault13 vault)

              {

                  try

                  {

                      IEdmHistory history = vault.CreateUtility(EdmUtility.EdmUtil_History) as IEdmHistory;

                      history.AddFile(File.ID);

       

                      Array historyItems = Array.CreateInstance(typeof(EdmHistoryItem), 0);

       

                      history.GetHistory(ref historyItems, (int)EdmHistoryType.Edmhist_FileRevision);

       

                      string targetRevision = ((EdmLib.EdmHistoryItem[])historyItems)[1].moData.mbsStrData1;

                      int targetVersion = ((EdmLib.EdmHistoryItem[])historyItems)[1].mlVersion;

       

                      IEdmEnumeratorVersion5 verEnum = default(IEdmEnumeratorVersion5);

                      verEnum = (IEdmEnumeratorVersion5)File;

       

                      IEdmVersion5 ver = default(IEdmVersion5);

                      ver = (IEdmVersion5)verEnum.GetVersion(targetVersion);

                      ver.Rollback();

                  }

                  catch (COMException exp)

                  {

                      string errorName, errorDesc;

                      vault.GetErrorString(exp.ErrorCode, out errorName, out errorDesc);

                      vault.MsgBox(0, errorDesc, EdmMBoxType.EdmMbt_OKOnly, errorName);

                  }

      ...

       

      Any sugestions?

      Mario