AFNotification Class
- Last UpdatedNov 18, 2025
- 18 minute read
- PI System
- AF SDK 2024 R2
- Developer

Inheritance Hierarchy
Namespace: OSIsoft.AF.Notification
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
[SerializableAttribute] public sealed class AFNotification : AFBaseElement, IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFNotification>, IAFTrace
<SerializableAttribute> Public NotInheritable Class AFNotification Inherits AFBaseElement Implements IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable(Of AFNotification), IAFTrace Dim instance As AFNotification
[SerializableAttribute] public ref class AFNotification sealed : public AFBaseElement, IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFNotification^>, IAFTrace
[<SealedAttribute>] [<SerializableAttribute>] type AFNotification = class inherit AFBaseElement interface IAFTransactable interface IAFChangedEvent interface IAFSecurable interface IComparable<AFNotification> interface IAFTrace end
The AFNotification type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| AFNotification | Obsolete.
Initializes a new instance of the class with default values.
| |
| AFNotification(String) | Obsolete.
Initializes a new instance of the class with the specified name.
| |
| AFNotification(AFDatabase) |
Initializes a new instance of the class with default values.
| |
| AFNotification(String, AFElementTemplate) | Obsolete.
Initializes a new instance of the class with the specified name.
| |
| AFNotification(AFDatabase, String) |
Initializes a new instance of the class with the specified name.
| |
| AFNotification(String, AFNotificationTemplate, AFBaseElement) | Obsolete.
Initializes a new instance of the class with the specified name.
| |
| AFNotification(AFDatabase, String, AFNotificationTemplate, AFBaseElement) |
Initializes a new instance of the class with the specified name.
|
Properties
| Name | Description | |
|---|---|---|
| Analysis |
The AFAnalysis that is used for delivering the notification events.
| |
| Attributes |
This is a collection of attributes that are owned by this element.
(Inherited from AFBaseElement.) | |
| Categories |
This is a user-defined collection of categories for the object that can be used for
querying and/or reporting purposes.
(Inherited from AFBaseElement.) | |
| CategoriesString |
This read-only property returns the list of categories in a string separated by semicolons.
(Inherited from AFBaseElement.) | |
| ChangeOnly |
A flag to indicate that only change notifications should be sent for the notification.
| |
| CheckOutInfo |
This read-only property returns the checked out status information for the object.
| |
| Contents |
The collection of contents used when sending notifications.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
(Inherited from AFBaseElement.) | |
| DefaultAttribute |
The default AFAttribute for the AFBaseElement.
(Inherited from AFBaseElement.) | |
| DefaultInputPort |
The default input AFPort for the AFBaseElement.
(Inherited from AFBaseElement.) | |
| DefaultOutputPort |
The default output AFPort for the AFBaseElement.
(Inherited from AFBaseElement.) | |
| DefaultUndirectedPort |
The default undirected AFPort for the AFBaseElement.
(Inherited from AFBaseElement.) | |
| Description |
Read/write property that provides a more detailed description of the object.
(Inherited from AFBaseElement.) | |
| ErrorMessage |
The last error message associated with an error status.
| |
| ExpirationPeriod |
Expiration period for the notification.
| |
| ExtendedProperties |
A dictionary of extended properties that can be used to store application specific information.
(Inherited from AFBaseElement.) | |
| FallingBehindOption |
Falling behind option for the notification.
| |
| ID |
Read-only property that provides a unique identifier for the object to be used for
quick access that is not dependent upon the index.
(Inherited from AFObject.) | |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFObject.) | |
| IsAnnotated |
This property indicates whether this element has any annotations.
(Inherited from AFBaseElement.) | |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| IsDirty |
This read-only property indicates whether the object has been modified since the
last save to the PI AF Server.
| |
| IsNew |
This read-only property indicates whether the object is new and has never been saved
to the PI AF Server.
| |
| MinimumAcknowledgements |
The minimum number of acknowledgments before the notification is considered to be acknowledged.
| |
| Name |
Read/write property that identifies the name of the object.
(Inherited from AFBaseElement.) | |
| NonrepetitionInterval |
Non-repetition interval for the notification.
| |
| NotificationContact | Obsolete.
The AFNotificationContact that will receive the notifications events.
| |
| NotificationContacts |
The collection of notification contacts to be notified by this notification.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| Ports |
This is a collection of AFPort objects representing the possible connection ports
for this element.
Ports are used in a AFModel to define an AFConnection
between AFBaseElement object.
(Inherited from AFBaseElement.) | |
| Priority |
The priority of the AFNotification.
| |
| ResendInterval |
The interval for resending the notification.
| |
| Security |
This read-only property returns the AFSecurity information for the object.
| |
| Status |
The current notification status.
| |
| Target |
The target of the AFAnalysis associated with this notification.
| |
| Template |
The AFElementTemplate that was used to define this object.
(Inherited from AFBaseElement.) | |
| Type |
This read-only property specifies the base type of the element.
(Inherited from AFBaseElement.) | |
| UniqueID |
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.) |
Methods
| Name | Description | |
|---|---|---|
| ApplyChanges |
This method applies the changes to the object and makes
those changes available to other objects for the current user.
| |
| CheckIn |
This method checks in (commits) all the changes to the object by saving
the information to persistent storage.
| |
| CheckOut |
This method locks the object so that its configuration can be modified.
| |
| CompareTo(Object) |
Compares this instance with a specified Object.
(Inherited from AFObject.) | |
| CompareTo(AFObject) |
Compares this instance with a specified AFObject.
(Inherited from AFObject.) | |
| CreateElementTemplate |
Create an AFElementTemplate based upon the element.
(Inherited from AFBaseElement.) | |
| Delete |
Deletes this notification from the AFDatabase.
| |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.) | |
| Equals(AFObject) |
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.) | |
| FindContact |
Used for finding the AFNotificationContact with a given ID for
the notification contact, contact definition, or its template.
| |
| FindNotification(PISystem, Guid) |
Retrieves the AFNotification object with the specified unique identifier
at the AFTime.MaxValue query date.
| |
| FindNotification(PISystem, Guid, Object) |
Retrieves the AFNotification object with the specified unique identifier
at the specified query date.
| |
| FindNotifications(PISystem, Guid, Object) |
Performs a search within the PISystem to retrieve a collection
of AFNotification objects with the specified list of unique identifiers.
| |
| FindNotifications(AFDatabase, String, AFSearchField, AFSortField, AFSortOrder, Int32) |
Performs a non-paged text search within the AFDatabase to retrieve a collection
of AFNotification objects which have a field that matches the specified query string.
| |
| FindNotifications(AFDatabase, String, AFCategory, AFElementTemplate, AFSortField, AFSortOrder, Int32) |
Performs a non-paged search within the AFDatabase to retrieve a collection
of AFNotification objects that match the specified query string and
additional filters.
| |
| FindNotifications(AFDatabase, String, AFSearchField, AFSortField, AFSortOrder, Int32, Int32, Int32) |
Performs a paged text search within the AFDatabase to retrieve a collection
of AFNotification objects which have a field that match the specified query string.
| |
| FindNotifications(AFDatabase, String, String, AFCategory, AFElementTemplate, AFElement, AFContact, AFStatus, AFSortField, AFSortOrder, Int32) |
Performs a non-paged search within the AFDatabase to retrieve a collection
of AFNotification objects that match the specified query strings and
additional filters.
| |
| FindNotifications(AFDatabase, String, String, AFCategory, AFElementTemplate, AFElement, AFContact, AFStatus, AFSortField, AFSortOrder, Int32, Int32) |
Performs a paged search within the AFDatabase to retrieve a collection
of AFNotification objects that match the specified query strings and
additional filters.
| |
| FindNotificationsByContact |
Performs a non-paged search to retrieve a collection of all the AFNotification
objects that have the specified AFContact configured to receive
the notification.
| |
| FindNotificationsByContactTemplate |
Performs a non-paged search to retrieve a collection of all the AFNotification
objects that have the specified AFNotificationContactTemplate configured to receive
the notification.
| |
| FindNotificationsByElement |
Performs a non-paged search to retrieve a collection of all the AFNotification
objects that have the specified AFElement as a target of its analysis.
| |
| GetAnnotations |
Retrieves a collection of existing AFAnnotation objects belonging to this
AFBaseElement.
(Inherited from AFBaseElement.) | |
| GetAttributeByTrait |
Retrieves the child AFAttribute with the specified AFAttributeTrait.
(Inherited from AFBaseElement.) | |
| GetAttributesByTrait |
Retrieves a list of child AFAttribute objects identified by the specified list of attribute traits.
(Inherited from AFBaseElement.) | |
| 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.
(Inherited from AFObject.) | |
| GetPath |
Returns the full path to the object, using just the names.
(Inherited from AFObject.) | |
| GetPath(AFObject) |
Returns the path to the object relative from another object.
(Inherited from AFObject.) | |
| GetPath(AFEncodeType, AFObject) |
Returns the path to the object relative from another object,
using the name and/or id as specified
by encodeType.
(Inherited from AFObject.) | |
| GetSecurity |
Gets the AFSecurity information of the specified security item
associated with the object.
| |
| GetStatus |
Get the notification's Status property immediately in the PI AF Server.
| |
| GetStatus(IListAFNotification) |
Get the status for the list of notifications from the PI AF Server.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IsTraced |
Indicates if a specified level is being traced.
| |
| IsTypeOf |
Checks if the current AFBaseElement is derived from the
specified AFElementTemplate.
(Inherited from AFBaseElement.) | |
| LoadNotifications(IListAFNotification, Boolean) |
Loads the specified list of AFNotification objects.
| |
| LoadNotifications(PISystem, Guid, Object) |
Loads the AFNotification objects with the specified unique identifiers
at the specified query date.
| |
| LoadTargets |
Loads the Target of the specified list of AFNotification objects.
| |
| Persist |
This method returns the persistence string for the object.
(Inherited from AFObject.) | |
| Refresh |
Refreshes the client with any changes that have been made to the object since loaded.
| |
| SetNotificationContact(String) | Obsolete.
The SetNotificationContact method sets the NotificationContact
property to a newly created AFNotificationContact with the specified name.
| |
| SetNotificationContact(AFNotificationContactTemplate) | Obsolete.
The SetNotificationContact method sets the NotificationContact
property to a newly created AFNotificationContact using the specified
AFNotificationContactTemplate.
| |
| SetNotificationContact(AFContact, String) | Obsolete.
The SetNotificationContact method sets the NotificationContact
property to a newly created AFNotificationContact using the specified
AFContact and name.
| |
| SetStatus(AFStatus, String) |
Set the notification's Status and ErrorMessage properties
immediately in the server.
| |
| SetStatus(IListAFNotification, AFStatus, String) |
Set the list of notifications to the specified status and error message.
| |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) | |
| TraceData |
Output a data trace event.
| |
| TraceDetail |
Output a detail trace event.
| |
| TraceError |
Output an error trace event.
| |
| TraceEvent(AFTraceSwitchLevel, String) |
Output a trace event with a message.
| |
| TraceEvent(AFTraceSwitchLevel, String, Int32) |
Output a trace event with a message and a duration.
| |
| TraceEvent(AFTraceSwitchLevel, String, Object) |
Output a trace event as a formatted message with a variable number of arguments.
| |
| TraceInformation |
Output an information trace event.
| |
| TraceSummary |
Output a summary trace event.
| |
| TraceWarning |
Output a warning trace event.
| |
| UndoCheckOut |
This method discards all the changes to the object and all sub-objects since the
last call to CheckOut. Any changes since the check out will be lost.
|
Events
| Name | Description | |
|---|---|---|
| Changed |
Event is raised when the object or one of its sub-objects is changed.
|
Remarks
A notification can be created from an AFNotificationTemplate, or without a template. When based on a template, the notification will derive its initial definition of Categories, Attributes, NotificationContacts, and Contents from the template. Later modifications to the template will be propagated to all notifications created from it. If the template allows it, or if the notification was not created from a template, then the notification's categories, attributes, notification contacts, and contents can be augmented with additional members.
Use the PISystem.Supports method to check if the PISystem supports the Notification feature.
Examples
// This example demonstrates how to create a notification template that // uses an analysis template, create a notification from the template, // and displays its information. // Get the Database PISystems myPISystems = new PISystems(); AFDatabase myDB = myPISystems.DefaultPISystem.Databases.DefaultDatabase; // Create an Element Template, an Analysis Template, and target Element AFElementTemplate myElemTemplate = myDB.ElementTemplates.Add("MyTargetTemplate"); AFAnalysisTemplate myAnalysisTemplate = myDB.AnalysisTemplates.Add("MyAnalysis"); myAnalysisTemplate.Target = myElemTemplate; AFElement myTargetElement = myDB.Elements.Add("MyTarget", myElemTemplate); // Create a Notification Template configured to AutoCreate its Target AFNotificationTemplate myNotificationTemplate = new AFNotificationTemplate("MyNotificationTemplate"); myNotificationTemplate.Description = "Template used to create my notifications"; myNotificationTemplate.AnalysisTemplate = myAnalysisTemplate; myNotificationTemplate.AutoCreate = AFNotificationTemplate.AutoCreateOption.AutoCreate; myDB.ElementTemplates.Add(myNotificationTemplate); // Create a Notification from the Notification Template AFNotification myNotification = new AFNotification(myDB, "MyNotification", myNotificationTemplate, myTargetElement); myDB.CheckIn(); // Display the name and description of the Notification Template Console.WriteLine("Name of Notification Template = {0}", myNotificationTemplate.Name); Console.WriteLine("Description = {0}", myNotificationTemplate.Description); Console.WriteLine("UniqueID of Notification Template = {0}", myNotificationTemplate.UniqueID); // Display the name of all Notifications created from this Notification Template const int pageSize = 100; int startIndex = 0; int totalCount; do { AFNamedCollectionList<AFBaseElement> list = myNotificationTemplate.FindInstantiatedElements(true, AFSortField.Name, AFSortOrder.Ascending, startIndex, pageSize, out totalCount); foreach (AFBaseElement CurNotification in list) { Console.WriteLine("Name of Notification created from this template = {0}", CurNotification.Name); } startIndex = (startIndex + pageSize); // Advance to next page } while (startIndex < totalCount); // Display the names of the auto-created objects Console.WriteLine("Name of Notification's Analysis = {0}", myNotification.Analysis.Name); AFElement target = myNotification.Analysis.Target as AFElement; Console.WriteLine("Name of Analysis Target = {0}", target.Name);
' This example demonstrates how to create a notification template that ' uses an analysis template, create a notification from the template, ' and displays its information. ' Get the Database Dim myPISystems As New PISystems Dim myDB As AFDatabase = myPISystems.DefaultPISystem.Databases.DefaultDatabase ' Create an Element Template, an Analysis Template, and target Element Dim myElemTemplate As AFElementTemplate = myDB.ElementTemplates.Add("MyTargetTemplate") Dim myAnalysisTemplate As AFAnalysisTemplate = myDB.AnalysisTemplates.Add("MyAnalysis") myAnalysisTemplate.Target = myElemTemplate Dim myTargetElement As AFElement = myDB.Elements.Add("MyTarget", myElemTemplate) ' Create a Notification Template configured to AutoCreate its Target Dim myNotificationTemplate As AFNotificationTemplate = New AFNotificationTemplate("MyNotificationTemplate") myNotificationTemplate.Description = "Template used to create my notifications" myNotificationTemplate.AnalysisTemplate = myAnalysisTemplate myNotificationTemplate.AutoCreate = AFNotificationTemplate.AutoCreateOption.AutoCreate myDB.ElementTemplates.Add(myNotificationTemplate) ' Create a Notification from the Notification Template Dim myNotification As AFNotification = New AFNotification(myDB, "MyNotification", myNotificationTemplate, myTargetElement) myDB.CheckIn() ' Display the name and description of the Notification Template Console.WriteLine("Name of Notification Template = {0}", myNotificationTemplate.Name) Console.WriteLine("Description = {0}", myNotificationTemplate.Description) Console.WriteLine("UniqueID = {0}", myNotificationTemplate.UniqueID) ' Display the name of all Notifications created from this Notification Template Dim pageSize As Integer = 100 Dim startIndex As Integer = 0 Dim totalCount As Integer Dim list As AFNamedCollectionList(Of AFBaseElement) Do list = myNotificationTemplate.FindInstantiatedElements(True, AFSortField.Name, AFSortOrder.Descending, startIndex, pageSize, totalCount) Dim CurNotification As AFBaseElement For Each CurNotification In list Console.WriteLine("Name of Notification created from this template = {0}", CurNotification.Name) Next CurNotification startIndex = (startIndex + pageSize) ' Advance to next page Loop While (startIndex < totalCount) ' Display the names of the auto-created objects Console.WriteLine("Name of Notification's Analysis = {0}", myNotification.Analysis.Name) Dim target As AFElement = CType(myNotification.Analysis.Target, AFElement) Console.WriteLine("Name of Analysis Target = {0}", target.Name)
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.