Code on this form enumerates Audit Fields as follows:
Try
' 1) ask for output file
Dim sfd As New System.Windows.Forms.SaveFileDialog
sfd.Title = "Save Audit Field Changes As"
sfd.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"
sfd.CheckPathExists = True
sfd.FilterIndex = 0
If sfd.ShowDialog() = System.Windows.Forms.DialogResult.OK And _
sfd.FileName.Length > 0 Then
' we are good
Else
Throw New Exception("File was not selected")
End If
' 2) list of lines
Dim lstOut As New System.Collections.Generic.List(Of String)
' 3) get a list of all audit fields
Dim lstFields As EllieMae.Encompass.Collections.StringList = Loan.AuditTrail.GetAuditFieldList()
' 4) enumerate all entries for all fields
For Each sField As String In lstFields
Dim lstEntries As EllieMae.Encompass.Collections.AuditTrailEntryList = Loan.AuditTrail.GetHistory(sField)
For Each entry As AuditTrailEntry In lstEntries
' add to list with Date/Time first to have the list string-sortable
Dim sLine As String = _
entry.Timestamp.ToString("yyyy-MM-dd HH:mm:ss") & vbTab & _
entry.UserID & vbTab & _
entry.Field.ID & vbTab & _
entry.Field.UnformattedValue
lstOut.Add(sLine)
Next
Next
' 5) sort list
lstOut.Sort()
' 6) single string
Dim sOut As String = String.Join(vbCrLf, lstOut.ToArray())
' 7) output to file
Using fs As System.IO.FileStream = New System.IO.FileStream( _
sfd.FileName, System.IO.FileMode.Create, System.IO.FileAccess.Write)
Using sw As System.IO.StreamWriter = New System.IO.StreamWriter(fs)
sw.Write(sOut)
End Using
End Using
' 8) success message
MsgBox("File saved: " + sfd.FileName, 64, "Success")
' 9) Open file with Notepad
Shell("Notepad.exe """ & sfd.FileName & """", 1)
Catch ex As Exception
MsgBox("Error: " & ex.Message)
End Try