ObjectKey(Index: Integer): Integer;
Index - index of a position. The number of keys is determined by the ObjectKeyCount property.
The ObjectKey property determines a key of an object for that protocol records are displayed.
Executing the example requires that the repository contains a report with the Report identifier and a form. The form must contain a button with the Button1 identifier and the ListView component with the ListView1 identifier, for which two columns are created: operation name and date. The Button1OnClick handler is determined for the button.
Class MyForm: Form
Button1: Button;
ListView1: ListView;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Mb: IMetabase;
Log: IAuditLog;
Con: IAuditFilterCondition;
Fil: IAuditFilter;
objectKey : Integer;
Begin
Mb := MetabaseClass.Active;
Log := Mb.Security.OpenAuditLog;
Fil := Log.Filter;
If Fil.Count <= 0 Then
Con := Fil.Add;
Else
Con := Fil.Item(0);
End If;
Con.IncludeFailedLogons := False;
Con.IncludeSucceededLogons := False;
objectKey := MB.ItemById("Report").Key;
Con.ObjectKeyCount := 1;
Con.ObjectKey(0) := objectKey;
FillLogListView(Log.OpenOperationTree(-1, -1));
End Sub Button2OnClick;
Sub FillLogListView(operations:IAuditOperations);
Var
listItem : IListViewItem;
d : DateTime;
Begin
ListView1.Items.Clear;
While Not operations.Eof Do
listItem := ListView1.Items.Add("");
listItem.ColumnText(0) := operations.Name;
d := DateTime.FromDouble(operations.Stamp);
listItem.ColumnText(1) := d.ToString;
operations.Next;
End While; operations.Eof
End Sub FillLogListView;
End Class MyForm;
After clicking the button a list of operations performed on object is displayed in the ListView component. Name, date and time are displayed for each operation.
See also: