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

AF SDK Reference

AFNotification Class

  • Last UpdatedNov 18, 2025
  • 18 minute read
AFNotification Class
The AFNotification is a class representing objects used to generate a notification.

Inheritance Hierarchy

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.AssetAFBaseElement
      OSIsoft.AF.NotificationAFNotification

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

  NameDescription
Public method
AFNotification Obsolete.
Initializes a new instance of the class with default values.
Public method
AFNotification(String) Obsolete.
Initializes a new instance of the class with the specified name.
Public method
AFNotification(AFDatabase)
Initializes a new instance of the class with default values.
Public method
AFNotification(String, AFElementTemplate) Obsolete.
Initializes a new instance of the class with the specified name.
Public method
AFNotification(AFDatabase, String)
Initializes a new instance of the class with the specified name.
Public method
AFNotification(String, AFNotificationTemplate, AFBaseElement) Obsolete.
Initializes a new instance of the class with the specified name.
Public method
AFNotification(AFDatabase, String, AFNotificationTemplate, AFBaseElement)
Initializes a new instance of the class with the specified name.

Properties

  NameDescription
Public property
Analysis
The AFAnalysis that is used for delivering the notification events.
Public property
Attributes
This is a collection of attributes that are owned by this element.
(Inherited from AFBaseElement.)
Public property
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.)
Public property
CategoriesString
This read-only property returns the list of categories in a string separated by semicolons.
(Inherited from AFBaseElement.)
Public property
ChangeOnly
A flag to indicate that only change notifications should be sent for the notification.
Public property
CheckOutInfo
This read-only property returns the checked out status information for the object.
Public property
Contents
The collection of contents used when sending notifications.
Public property
Database
This read-only property returns the AFDatabase where this object is defined.
(Inherited from AFBaseElement.)
Public property
DefaultAttribute
The default AFAttribute for the AFBaseElement.
(Inherited from AFBaseElement.)
Public property
DefaultInputPort
The default input AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public property
DefaultOutputPort
The default output AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public property
DefaultUndirectedPort
The default undirected AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public property
Description
Read/write property that provides a more detailed description of the object.
(Inherited from AFBaseElement.)
Public property
ErrorMessage
The last error message associated with an error status.
Public property
ExpirationPeriod
Expiration period for the notification.
Public property
ExtendedProperties
A dictionary of extended properties that can be used to store application specific information.
(Inherited from AFBaseElement.)
Public property
FallingBehindOption
Falling behind option for the notification.
Public property
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.)
Public property
Identity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public property
IsAnnotated
This property indicates whether this element has any annotations.
(Inherited from AFBaseElement.)
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
IsDirty
This read-only property indicates whether the object has been modified since the last save to the PI AF Server.
Public property
IsNew
This read-only property indicates whether the object is new and has never been saved to the PI AF Server.
Public property
MinimumAcknowledgements
The minimum number of acknowledgments before the notification is considered to be acknowledged.
Public property
Name
Read/write property that identifies the name of the object.
(Inherited from AFBaseElement.)
Public property
NonrepetitionInterval
Non-repetition interval for the notification.
Public property
NotificationContact Obsolete.
The AFNotificationContact that will receive the notifications events.
Public property
NotificationContacts
The collection of notification contacts to be notified by this notification.
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
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.)
Public property
Priority
The priority of the AFNotification.
Public property
ResendInterval
The interval for resending the notification.
Public property
Security
This read-only property returns the AFSecurity information for the object.
Public property
Status
The current notification status.
Public property
Target
The target of the AFAnalysis associated with this notification.
Public property
Template
The AFElementTemplate that was used to define this object.
(Inherited from AFBaseElement.)
Public property
Type
This read-only property specifies the base type of the element.
(Inherited from AFBaseElement.)
Public property
UniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)

Methods

  NameDescription
Public methodCode example
ApplyChanges
This method applies the changes to the object and makes those changes available to other objects for the current user.
Public methodCode example
CheckIn
This method checks in (commits) all the changes to the object by saving the information to persistent storage.
Public method
CheckOut
This method locks the object so that its configuration can be modified.
Public method
CompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public method
CompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public method
CreateElementTemplate
Create an AFElementTemplate based upon the element.
(Inherited from AFBaseElement.)
Public method
Delete
Deletes this notification from the AFDatabase.
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public method
Equals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public method
FindContact
Used for finding the AFNotificationContact with a given ID for the notification contact, contact definition, or its template.
Public methodStatic member
FindNotification(PISystem, Guid)
Retrieves the AFNotification object with the specified unique identifier at the AFTime.MaxValue query date.
Public methodStatic member
FindNotification(PISystem, Guid, Object)
Retrieves the AFNotification object with the specified unique identifier at the specified query date.
Public methodStatic memberCode example
FindNotifications(PISystem, Guid, Object)
Performs a search within the PISystem to retrieve a collection of AFNotification objects with the specified list of unique identifiers.
Public methodStatic memberCode example
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.
Public methodStatic memberCode example
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.
Public methodStatic memberCode example
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.
Public methodStatic memberCode example
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.
Public methodStatic memberCode example
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public method
GetAnnotations
Retrieves a collection of existing AFAnnotation objects belonging to this AFBaseElement.
(Inherited from AFBaseElement.)
Public method
GetAttributeByTrait
Retrieves the child AFAttribute with the specified AFAttributeTrait.
(Inherited from AFBaseElement.)
Public method
GetAttributesByTrait
Retrieves a list of child AFAttribute objects identified by the specified list of attribute traits.
(Inherited from AFBaseElement.)
Public method
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.)
Public method
GetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public method
GetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public method
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.)
Public method
GetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
Public method
GetStatus
Get the notification's Status property immediately in the PI AF Server.
Public methodStatic member
GetStatus(IListAFNotification)
Get the status for the list of notifications from the PI AF Server.
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
IsTraced
Indicates if a specified level is being traced.
Public method
IsTypeOf
Checks if the current AFBaseElement is derived from the specified AFElementTemplate.
(Inherited from AFBaseElement.)
Public methodStatic memberCode example
LoadNotifications(IListAFNotification, Boolean)
Loads the specified list of AFNotification objects.
Public methodStatic memberCode example
LoadNotifications(PISystem, Guid, Object)
Loads the AFNotification objects with the specified unique identifiers at the specified query date.
Public methodStatic memberCode example
LoadTargets
Loads the Target of the specified list of AFNotification objects.
Public method
Persist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public method
Refresh
Refreshes the client with any changes that have been made to the object since loaded.
Public method
SetNotificationContact(String) Obsolete.
The SetNotificationContact method sets the NotificationContact property to a newly created AFNotificationContact with the specified name.
Public method
SetNotificationContact(AFNotificationContactTemplate) Obsolete.
The SetNotificationContact method sets the NotificationContact property to a newly created AFNotificationContact using the specified AFNotificationContactTemplate.
Public method
SetNotificationContact(AFContact, String) Obsolete.
The SetNotificationContact method sets the NotificationContact property to a newly created AFNotificationContact using the specified AFContact and name.
Public method
SetStatus(AFStatus, String)
Set the notification's Status and ErrorMessage properties immediately in the server.
Public methodStatic member
SetStatus(IListAFNotification, AFStatus, String)
Set the list of notifications to the specified status and error message.
Public method
ToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public method
TraceData
Output a data trace event.
Public method
TraceDetail
Output a detail trace event.
Public method
TraceError
Output an error trace event.
Public method
TraceEvent(AFTraceSwitchLevel, String)
Output a trace event with a message.
Public method
TraceEvent(AFTraceSwitchLevel, String, Int32)
Output a trace event with a message and a duration.
Public method
TraceEvent(AFTraceSwitchLevel, String, Object)
Output a trace event as a formatted message with a variable number of arguments.
Public method
TraceInformation
Output an information trace event.
Public method
TraceSummary
Output a summary trace event.
Public method
TraceWarning
Output a warning trace event.
Public method
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

  NameDescription
Public eventCode example
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.

Version Information

AFSDK


See Also

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