AFAuditTrail.GetFirst Method (AFObject, Boolean, AFTimeRange, Int32)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Read audit trail events from the PISystem for the requested time range up to the specified maximum count.
Namespace: OSIsoft.AF.Diagnostics
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public DataTable GetFirst( AFObject item, bool includeHierarchy, AFTimeRange timeRange, int maxCount )
Public Function GetFirst ( item As AFObject, includeHierarchy As Boolean, timeRange As AFTimeRange, maxCount As Integer ) As DataTable Dim instance As AFAuditTrail Dim item As AFObject Dim includeHierarchy As Boolean Dim timeRange As AFTimeRange Dim maxCount As Integer Dim returnValue As DataTable returnValue = instance.GetFirst(item, includeHierarchy, timeRange, maxCount)
public: DataTable^ GetFirst( AFObject^ item, bool includeHierarchy, AFTimeRange timeRange, int maxCount )
member GetFirst : item : AFObject * includeHierarchy : bool * timeRange : AFTimeRange * maxCount : int -> DataTable
Parameters
- item
- Type: OSIsoft.AFAFObject
The PI AF reference object for viewing audit trail events. - includeHierarchy
- Type: SystemBoolean
Return audit trail results for objects nested further than the current referenced object. - timeRange
- Type: OSIsoft.AF.TimeAFTimeRange
Time range for reading audit trail events from the PISystem. - maxCount
- Type: SystemInt32
Maximum number of audit trail events to return in the requested time range.
Return Value
Type: DataTableReturns a DataTable containing the audit trail events for the requested object in the requested timeRange or until the specified maxCount is reached. If the returned DataTable contains maxCount events, then use GetNext method to walk to next set of events in the originally requested time range.
Remarks
This method returns the first page of audit trail events within the requested timeRange
up to the specified maxCount for the requested object. The GetNext method can be used
to read the next page of audit trail events if they are not all returned when calling this method.
The details for an event can be read using the GetDetails(DataRow) method.