Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFAuditTrail.GetFirst Method (AFObject, Boolean, AFTimeRange, Int32)

AFAuditTrail.GetFirst Method (AFObject, Boolean, AFTimeRange, Int32)

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFAuditTrail.GetFirst Method (AFObject, Boolean, AFTimeRange, Int32)
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: DataTable
Returns 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.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5

See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in