AnsweredAssumed Answered

Rollback to "Revision:" Event API

Question asked by Mario Zahren on Sep 23, 2016
Latest reply on Dec 20, 2018 by Jerome De San Nicolás

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

Outcomes