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

AF SDK Reference

AFNotification.FindNotifications Method (PISystem, Guid[], Object)

AFNotification.FindNotifications Method (PISystem, Guid[], Object)

  • Last UpdatedNov 18, 2025
  • 5 minute read
AFNotification.FindNotifications Method (PISystem, Guid[], Object)
Performs a search within the PISystem to retrieve a collection of AFNotification objects with the specified list of unique identifiers.

Namespace:  OSIsoft.AF.Notification
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public static AFNamedCollectionList<AFNotification> FindNotifications(
	PISystem system,
	Guid[] ids,
	Object queryDate = null
)
Public Shared Function FindNotifications ( 
	system As PISystem,
	ids As Guid(),
	Optional queryDate As Object = Nothing
) As AFNamedCollectionList(Of AFNotification)

Dim system As PISystem
Dim ids As Guid()
Dim queryDate As Object
Dim returnValue As AFNamedCollectionList(Of AFNotification)

returnValue = AFNotification.FindNotifications(system, 
	ids, queryDate)
public:
static AFNamedCollectionList<AFNotification^>^ FindNotifications(
	PISystem^ system, 
	array<Guid>^ ids, 
	Object^ queryDate = nullptr
)
static member FindNotifications : 
        system : PISystem * 
        ids : Guid[] * 
        ?queryDate : Object 
(* Defaults:
        let _queryDate = defaultArg queryDate null
*)
-> AFNamedCollectionList<AFNotification> 

Parameters

system
Type: OSIsoft.AFPISystem
The PISystem to search for the desired objects.
ids
Type: SystemGuid
An array of the unique identifiers of the objects to load.
queryDate (Optional)
Type: SystemObject
The query date used to load the objects. Specify or AFTime.MaxValue for most recent versions of the objects. The value may be an AFTime, DateTime, PITime, String, or numeric. A DateTime (or a DATE will be treated as UTC time if its Kind property is set to Unspecified. Because DATE values from COM or VB6 clients are marshalled as Unspecified, these client applications must convert to UTC prior to marshalling. An integer numeric represents the number of ticks (100-nanosecond intervals) since January 1, 0001. A floating point numeric represents the number of seconds since January 1, 1970 UTC. A String is interpreted as local time, unless it contains a time zone indicator such as a trailing "Z" or "GMT". Strings will be interpreted with the AFTime.Parse Overload methods so that relative formats with intervals ("*", "T+3h", etc.) are also supported. Relative time intervals are based on AFTime.Now.

Return Value

Type: AFNamedCollectionListAFNotification
Returns a collection of the objects in the system which match the unique identifiers in the ids list at the specified queryDate. If no object can be found for a unique identifier in the list, there will be no corresponding entry in the returned collection. The order of items in the returned collection might not match the order of specified ids, but the returned collection items can be accessed by ID.

Remarks

This method will search for matching objects at the specified queryDate based upon its ID and load its header from the server if not already loaded in the SDK. If you need a fully loaded object, then the LoadNotifications(PISystem, Guid, Object) method should be used instead.

Examples

// Loading a list of Notifications for display is a common task whose performance can be
// greatly improved by using bulk retrieval methods.Notifications typically reference several other top-level
// AF Objects, such as Analyses, Analysis Templates, Elements, Element Templates, and Element paths.
// This example uses several methods to illustrate how to load such a list.

// Get the Default Database
PISystems myPISystems = new PISystems();
AFDatabase myDB = myPISystems.DefaultPISystem.Databases.DefaultDatabase;
if (myDB == null)
    throw new InvalidOperationException("Database was not found.");

// Find notifications to load.  As with all top-level objects, the
// notifications returned are only partially loaded into memory.  
AFNamedCollectionList<AFNotification> notifications =
    AFNotification.FindNotifications(myDB, "", AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 100);

// The LoadNotifications call will fully load the notification into memory.
// The second parameter indicates whether the analysis should be loaded as well.
// For example, if you were going to display or edit analysis information, you would
// set this parameter to true.
AFNotification.LoadNotifications(notifications, false);

// Notifications target other AFObjects.  We can cause those to be loaded via this call.
// Note that typically, notifications target single AFElements, however, in the future,
// there may be other types of objects targeted.
IList<object> targets = AFNotification.LoadTargets(notifications, false);

// Now output the notifications.  There should be no more calls to the server at this point.
foreach (AFNotification notification in notifications)
{
    AFObject target = notification.Target as AFObject;
    if (target != null)
        Console.WriteLine("{0}: {1}", notification, target.GetPath());
    else
        Console.WriteLine("{0}: {1}", notification, notification.Target);
}
' Loading a list of Notifications for display is a common task whose performance can be
' greatly improved by using bulk retrieval methods.Notifications typically reference several other top-level
' AF Objects, such as Analyses, Analysis Templates, Elements, Element Templates, and Element paths.
' This example uses several methods to illustrate how to load such a list.

' Get the Default Database
Dim myPISystems As New PISystems()
Dim myDB As AFDatabase = myPISystems.DefaultPISystem.Databases.DefaultDatabase
If myDB Is Nothing Then
    Throw New InvalidOperationException("Database was not found.")
End If

' Find notifications to load.  As with all top-level objects, the
' notifications returned are only partially loaded into memory.  
Dim notifications As AFNamedCollectionList(Of AFNotification) =
    AFNotification.FindNotifications(myDB, "", AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 100)

' The LoadNotifications call will fully load the notification into memory.
' The second parameter indicates whether the analysis should be loaded as well.
' For example, if you were going to display or edit analysis information, you would
' set this parameter to true.
AFNotification.LoadNotifications(notifications, False)

' Notifications target other AFObjects.  We can cause those to be loaded via this call.
' Note that typically, notifications target single AFElements, however, in the future,
' there may be other types of objects targeted.
Dim targets As IList(Of Object) = AFNotification.LoadTargets(notifications, False)

' Now output the notifications.  There should be no more calls to the server at this point.
For Each notification As AFNotification In notifications
    Dim target As AFObject = TryCast(notification.Target, AFObject)
    If target IsNot Nothing Then
        Console.WriteLine("{0}: {1}", notification, target.GetPath())
    Else
        Console.WriteLine("{0}: {1}", notification, notification.Target)
    End If
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.

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, 2.9, 2.8.5, 2.8, 2.7.5

See Also

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