Others may have a better method but from what I have seen, the only way to get the last version comment is to grab a reference to the file id through the edmcmd_prestate as you are doing then enumerate the history.
Private Sub ShowHistory(file As IEdmFile5)
On Error GoTo ErrHand
Dim verEnum As IEdmEnumeratorVersion5
Set verEnum = file
Dim pos As IEdmPos5
Set pos = verEnum.GetFirstVersionPosition
Dim ver As IEdmVersion5
Dim message As String
message = "History of " + file.name + ":" + vbLf
Dim str As String
While Not pos.IsNull
Set ver = verEnum.GetNextVersion(pos)
str = ver.versionNo
message = message + str
str = ver.fileDate
message = message + ", file date=" + str + ", user=" + ver.user.name
str = ver.FileSize
message = message + ", file size=" + str + " bytes, comment=" + ver.Comment + vbLf
Dim ename As String
Dim edesc As String
file.vault.GetErrorString Err.Number, ename, edesc
MsgBox ename + vbLf + edesc
I underscored the comment portion. You will need to enumerate through the versions until the last one unless you know the latest version #.
Enumerating through multiple files during transitions or enumerating through versions on files with several versions in the history could be less than desirable during a transition. May want to research a faster codebase to get there.
Just a thought.
It looks like you are looking at version comments as opposed to transition comments, those are accessable through IEDMHistory::GetHistory under the mbsComment value of a Edmhist_FileState event. Or you can pull them from the database, they're under the Comment column of the transitionhistory table.
Thanks for the replies guys.
I'm after the Transition comments, not the Version comments... (I assume they are different because you can have multiple Transitions per Version)
I'm also doing this in the middle of the Transition I want to grab the comments for - so I'm thinking they aren't going to be accessible (yet) as they shouldn't be in the database until the Transition is completed.
I guess I was hoping there was a specific Object for accessing 'in process' Transition comments - such as one of the ppoData objects sent to OnCmd.
I don't see anything in the ppoData you'd be able to use. If you are trying to force a format on the transition comment I believe the only method you have is to pop-up a seperate dialog after the user commits the transition, then cancel the transition action in the add-in and run another transition using the comment the user put in your custom dialog (you can edit version comments later but not transition comments :/)
Here's a basic implementation
Dim v8 As IEdmVault8 = New EdmVault5
Dim poHm As EdmLib.IEdmHistory
poHm = v8.CreateUtility(EdmLib.EdmUtility.EdmUtil_History)
poHm.AddFile("Insert DocumentID Here")
Dim result(100) As EdmHistoryItem
That's seems pretty easy. I haven't ever been able to figure this one out, which is a shame
Where did you come up with that?
Had to struggle through it, I got the basis from the API guide and had to throw in functions I used in the past as the guide for that part isn't very good...
Thanks for the heads up Charley. Whew! Was beginning to wonder if I was losing my touch because I have not found any sample code in the API help or anywhere else! Thank you for sharing your struggle!