AFNotification.LoadNotifications Method (IList(AFNotification), Boolean)
- Last UpdatedNov 18, 2025
- 4 minute read
- PI System
- AF SDK 2024 R2
- Developer
Loads the specified list of AFNotification objects.
Namespace: OSIsoft.AF.Notification
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static void LoadNotifications( IList<AFNotification> notifications, bool loadAnalyses )
Public Shared Sub LoadNotifications ( notifications As IList(Of AFNotification), loadAnalyses As Boolean ) Dim notifications As IList(Of AFNotification) Dim loadAnalyses As Boolean AFNotification.LoadNotifications(notifications, loadAnalyses)
public: static void LoadNotifications( IList<AFNotification^>^ notifications, bool loadAnalyses )
static member LoadNotifications : notifications : IList<AFNotification> * loadAnalyses : bool -> unit
Parameters
- notifications
- Type: System.Collections.GenericIListAFNotification
The list of notifications to be fully loaded. If , then this method does nothing. All notifications in the list must be from the same PISystem. - loadAnalyses
- Type: SystemBoolean
Indicates whether the analyses associated with the notifications should be fully loaded as well.
Remarks
Fully loads the specified list AFNotification objects from the server into
the client. This will ensure that the notifications in the list are fully loaded to avoid
a call to the server to load each of the notifications individually.
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.