AFChangeInfo Structure
- Last UpdatedNov 18, 2025
- 8 minute read
- PI System
- AF SDK 2024 R2
- Developer
The AFChangeInfo structure is used when returning information about objects
that have changed in the server.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public struct AFChangeInfo : IEquatable<AFChangeInfo>
Public Structure AFChangeInfo Implements IEquatable(Of AFChangeInfo) Dim instance As AFChangeInfo
public value class AFChangeInfo : IEquatable<AFChangeInfo>
[<SealedAttribute>] type AFChangeInfo = struct interface IEquatable<AFChangeInfo> end
The AFChangeInfo type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| Action |
The AFChangeInfoAction that caused the object to be changed.
| |
| ChangeTime |
The time that the object was changed.
| |
| Database |
The AFDatabase containing the changed object.
| |
| ID |
The ID of the changed object.
| |
| Identity |
The AFIdentity of the changed object.
| |
| IsValueUpdate |
The update associated with this change is a value update.
| |
| IsVersionAdded |
The update associated with this change is because a version was added.
| |
| ParentID |
The ID of the parent of the changed object.
| |
| VersionID |
The VersionID of the changed object.
|
Methods
| Name | Description | |
|---|---|---|
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Overrides ValueTypeEquals(Object).) | |
| Equals(AFChangeInfo) |
Indicates whether the current object is equal to another object of the same type.
| |
| FindObject(PISystem) |
Finds the object represented by change information structure and
automatically load from the server if not found.
| |
| FindObject(PISystem, Boolean) |
Finds the object represented by change information structure and optionally
automatically load from the server if not found.
| |
| GetHashCode |
Gets the hash code for this instance of the object which is suitable for use in hashing
algorithms and data structures like a hash table.
(Overrides ValueTypeGetHashCode.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| Refresh |
Refreshes the object represented by change information structure if it is
currently loaded in the client.
| |
| ToString |
Returns a String that represents the current object.
(Overrides ValueTypeToString.) |
Operators
| Name | Description | |
|---|---|---|
| Equality |
The equality operator (==) compares its operands to determine if they are equal.
| |
| Inequality |
The inequality operator (!=) compares its operands to determine if they are not equal.
|
Remarks
The AFChangeInfo structure is returned by the
PISystem.FindChangedItems Overload
and AFDatabase.FindChangedItems Overload
methods.
The actual object is not returned, but the information contained in the returned
structure can be used to find the changed object.
Examples
// This example demonstrates getting changes made by other users // and refreshing the objects. // Get the System and System Cookie PISystem myPISystem = new PISystems().DefaultPISystem; object sysCookie = myPISystem.GetFindChangedItemsCookie(searchSandbox: false); // Wait for changes to be made... //======================================================= // Find changes made by other users. List<AFChangeInfo> list = new List<AFChangeInfo>(); int resultsPerPage = 1000; while (true) { var results = myPISystem.FindChangedItems(false, true, resultsPerPage, sysCookie, out sysCookie); if ((results?.Count ?? 0) == 0) break; list.AddRange(results); } // Refresh objects that have been changed. AFChangeInfo.Refresh(myPISystem, list); // Find the objects that have been changed. foreach (AFChangeInfo info in list) { AFObject myObj = info.FindObject(myPISystem, false); Console.WriteLine("Found changed object: {0}", myObj); }
' This example demonstrates getting changes made by other users ' and refreshing the objects. ' Get the System and System Cookie Dim myPISystem As PISystem = New PISystems().DefaultPISystem Dim sysCookie As Object = myPISystem.GetFindChangedItemsCookie(searchSandbox:=False) ' Wait for changes to be made... '======================================================= ' Find changes made by other users. Dim list As New List(Of AFChangeInfo)() Dim resultsPerPage As Integer = 1000 While True Dim results As IList(Of AFChangeInfo) _ = myPISystem.FindChangedItems(False, True, resultsPerPage, sysCookie, sysCookie) If ((results Is Nothing) OrElse (results.Count = 0)) Then Exit While End If list.AddRange(results) End While ' Refresh objects that have been changed. AFChangeInfo.Refresh(myPISystem, list) ' Find the objects that have been changed. For Each info As AFChangeInfo In list Dim myObj As AFObject = info.FindObject(myPISystem, False) Console.WriteLine("Found changed object: {0}", myObj) Next
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
// This example demonstrates persisting and restoring the cookie // using the XmlSerializer. Other serializers could also be used. // Then the cookie is restored and used to get changes made while // the application was shut down. // Get the System and Database and their Cookie Values PISystem myPISystem = new PISystems().DefaultPISystem; AFDatabase myDB = myPISystem.Databases.DefaultDatabase; object sysCookie = myPISystem.GetFindChangedItemsCookie(searchSandbox: false); object dbCookie; myDB.FindChangedItems(false, int.MaxValue, null, out dbCookie); // Persist the cookie if you want to save to pick up changes // where you left off after restarting application. string tmpDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string sysCookieFile = Path.Combine(tmpDir, "AFSysCookie.xml"); string dbCookieFile = Path.Combine(tmpDir, "AFDbCookie.xml"); XmlSerializer serializer = new XmlSerializer(typeof(object[])); using (var stream = File.Create(sysCookieFile)) { serializer.Serialize(stream, sysCookie); } using (var stream = File.Create(dbCookieFile)) { serializer.Serialize(stream, dbCookie); } // Shut down application, and wait for changes to be made... //======================================================= // After application restarts, reload persisted cookies. using (var stream = File.OpenRead(sysCookieFile)) { sysCookie = serializer.Deserialize(stream); } using (var stream = File.OpenRead(dbCookieFile)) { dbCookie = serializer.Deserialize(stream); } // Find changes made while application not running. List<AFChangeInfo> list = new List<AFChangeInfo>(); int resultsPerPage = 1000; while (true) { var results = myPISystem.FindChangedItems(false, resultsPerPage, sysCookie, out sysCookie); if ((results?.Count ?? 0) == 0) break; list.AddRange(results); } while (true) { var results = myDB.FindChangedItems(false, resultsPerPage, dbCookie, out dbCookie); if ((results?.Count ?? 0) == 0) break; list.AddRange(results); } // Find the objects that have been changed. foreach (AFChangeInfo info in list) { AFObject myObj = info.FindObject(myPISystem, false); Console.WriteLine("Found changed object: {0}", myObj); }
' This example demonstrates persisting and restoring the cookie ' using the XmlSerializer. Other serializers could also be used. ' Then the cookie is restored and used to get changes made while ' the application was shut down. ' Get the System and Database and their Cookie Values Dim myPISystem As PISystem = New PISystems().DefaultPISystem Dim myDB As AFDatabase = myPISystem.Databases.DefaultDatabase Dim sysCookie As Object = myPISystem.GetFindChangedItemsCookie(searchSandbox:=False) Dim dbCookie As Object = Nothing myDB.FindChangedItems(False, Integer.MaxValue, Nothing, dbCookie) ' Persist the cookie if you want to save to pick up changes ' where you left off after restarting application. Dim tmpDir As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) Dim sysCookieFile As String = Path.Combine(tmpDir, "AFSysCookie.xml") Dim dbCookieFile As String = Path.Combine(tmpDir, "AFDbCookie.xml") Dim serializer As XmlSerializer = New XmlSerializer(GetType(Object())) Using stream As FileStream = File.Create(sysCookieFile) serializer.Serialize(stream, sysCookie) End Using Using stream As FileStream = File.Create(dbCookieFile) serializer.Serialize(stream, dbCookie) End Using ' Shut down application, and wait for changes to be made... '======================================================= ' After application restarts, reload persisted cookies. Using stream As FileStream = File.OpenRead(sysCookieFile) sysCookie = serializer.Deserialize(stream) End Using Using stream As FileStream = File.OpenRead(dbCookieFile) dbCookie = serializer.Deserialize(stream) End Using ' Find changes made while application not running. Dim list As List(Of AFChangeInfo) = New List(Of AFChangeInfo) Dim resultsPerPage As Integer = 1000 While True Dim results As IList(Of AFChangeInfo) _ = myPISystem.FindChangedItems(False, resultsPerPage, sysCookie, sysCookie) If ((results Is Nothing) OrElse (results.Count = 0)) Then Exit While End If list.AddRange(results) End While While True Dim results As IList(Of AFChangeInfo) _ = myDB.FindChangedItems(False, resultsPerPage, dbCookie, dbCookie) If ((results Is Nothing) OrElse (results.Count = 0)) Then Exit While End If list.AddRange(results) End While list.AddRange(myPISystem.FindChangedItems(False, Integer.MaxValue, sysCookie, sysCookie)) list.AddRange(myDB.FindChangedItems(False, Integer.MaxValue, dbCookie, dbCookie)) ' Find the objects that have been changed. For Each info As AFChangeInfo In list Dim myObj As AFObject = info.FindObject(myPISystem, False) Console.WriteLine("Found changed object: {0}", myObj) Next
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.