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

Inheritance Hierarchy
OSIsoft.AFAFObject
OSIsoft.AF.AssetAFElementTemplate
OSIsoft.AF.NotificationAFNotificationTemplate
Namespace: OSIsoft.AF.Notification
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
[SerializableAttribute] public sealed class AFNotificationTemplate : AFElementTemplate, IComparable<AFNotificationTemplate>
<SerializableAttribute> Public NotInheritable Class AFNotificationTemplate Inherits AFElementTemplate Implements IComparable(Of AFNotificationTemplate) Dim instance As AFNotificationTemplate
[SerializableAttribute] public ref class AFNotificationTemplate sealed : public AFElementTemplate, IComparable<AFNotificationTemplate^>
[<SealedAttribute>] [<SerializableAttribute>] type AFNotificationTemplate = class inherit AFElementTemplate interface IComparable<AFNotificationTemplate> end
The AFNotificationTemplate type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| AFNotificationTemplate |
Initializes a new instance of the class with default values.
| |
| AFNotificationTemplate(String) |
Initializes a new instance of the class with the specified name.
|
Properties
| Name | Description | |
|---|---|---|
| AllowElementToExtend |
This read/write property determines if additional attributes or ports can be added to
instances of AFBaseElement objects.
(Inherited from AFElementTemplate.) | |
| AnalysisTemplate |
The AFAnalysisTemplate used to create the AFAnalysis
for the AFNotification created from this template.
| |
| AnalysisTemplates |
This is a collection of analysis templates that target this element template.
(Inherited from AFElementTemplate.) | |
| AttributeTemplates |
Gets the collection of AFAttributeTemplate objects
that are owned by this template.
(Inherited from AFElementTemplate.) | |
| AutoCreate |
This property specifies the option for automatically creating an AFNotification
for an AFElement.
| |
| BaseTemplate |
This property returns the AFElementTemplate which this template inherits from.
(Inherited from AFElementTemplate.) | |
| BaseTemplateOnly |
This read/write property determines if instances of this AFBaseElement object
are allowed to be created. This is typically a BaseTemplate that contains some core
functionality for other derived templates.
(Inherited from AFElementTemplate.) | |
| CanBeAcknowledged |
This property is the default value for the CanBeAcknowledged
property of any new AFEventFrame created from this template.
(Inherited from AFElementTemplate.) | |
| Categories |
This is a user-defined collection of categories for the object that can be used for
querying and/or reporting purposes.
(Inherited from AFElementTemplate.) | |
| CategoriesString |
This read-only property returns the list of categories in a string separated by semicolons.
(Inherited from AFElementTemplate.) | |
| ChangeOnly |
A flag to indicate that only change notifications should be sent for the notification created from this template.
| |
| CheckOutInfo |
This read-only property returns the checked out status information for the object.
(Inherited from AFElementTemplate.) | |
| ChildReferenceTypes |
This is a read-only collection of all AFReferenceType objects that can be used to create
a child reference to an AFElement created from this template.
(Inherited from AFElementTemplate.) | |
| Contents |
The collection of contents used to create the AFNotificationContents
for the AFNotification created from this template.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
(Inherited from AFElementTemplate.) | |
| DefaultAttribute |
The AFAttributeTemplate associated with the default
AFAttribute for the AFBaseElement created from
this template.
(Inherited from AFElementTemplate.) | |
| DefaultInputPort |
The default input AFPort for the AFBaseElement
created from this template.
(Inherited from AFElementTemplate.) | |
| DefaultOutputPort |
The default output AFPort for the AFBaseElement
created from this template.
(Inherited from AFElementTemplate.) | |
| DefaultUndirectedPort |
The default undirected AFPort for the AFBaseElement
created from this template.
(Inherited from AFElementTemplate.) | |
| Description |
Read/write property that provides a more detailed description of the object.
(Inherited from AFElementTemplate.) | |
| ExpirationPeriod |
Expiration period for the notification created from this template.
| |
| ExtendedProperties |
A dictionary of extended properties that can be used to store application specific information.
(Inherited from AFElementTemplate.) | |
| FallingBehindOption |
Falling behind option for the notification created from this template.
| |
| HasAnalyses |
This read-only property returns if there are any
AFAnalysisTemplate objects that target this element template.
(Inherited from AFElementTemplate.) | |
| HasNotifications |
This read-only property returns if there are any
AFNotificationTemplate objects that target this element template.
(Inherited from AFElementTemplate.) | |
| 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.) | |
| InstanceType |
Specifies the System.Type used when creating
AFBaseElement objects from this template.
(Inherited from AFElementTemplate.) | |
| 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.
(Inherited from AFElementTemplate.) | |
| IsNew |
This read-only property indicates whether the object is new and has never been saved
to the PI AF Server.
(Inherited from AFElementTemplate.) | |
| MinimumAcknowledgements |
The minimum number of acknowledgments for the notification created from this template.
| |
| Name |
Read/write property that identifies the name of the object.
(Inherited from AFElementTemplate.) | |
| NamingPattern |
The naming pattern used when creating elements from this template.
(Inherited from AFElementTemplate.) | |
| NonrepetitionInterval |
Non-repetition interval for the notification created from this template.
| |
| NotificationContacts |
The collection of AFNotificationContact objects used to create the
AFNotificationContacts for the AFNotification created from
this template.
| |
| NotificationRuleTemplates |
This is a collection of AFNotificationRuleTemplate objects that target this element template.
(Inherited from AFElementTemplate.) | |
| ParentReferenceTypes |
This is a read-only collection of all AFReferenceType objects that can be used to create
a parent reference to an AFElement created from this template.
(Inherited from AFElementTemplate.) | |
| 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 elements created from this template.
Ports are used in a AFModel to define an AFConnection
between AFBaseElement object.
(Inherited from AFElementTemplate.) | |
| Priority |
The priority of the AFNotification created from this template.
| |
| ResendInterval |
The interval for resending the notification created from this template.
| |
| Security |
This read-only property returns the AFSecurity information for the object.
(Inherited from AFElementTemplate.) | |
| Severity |
This property is the default value for the Severity
property of any new AFEventFrame created from this template.
(Inherited from AFElementTemplate.) | |
| Target |
The target of the AFAnalysisTemplate associated with this notification template.
| |
| Type |
This property specifies the base type of the element created from this template.
(Inherited from AFElementTemplate.) | |
| 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.
(Inherited from AFElementTemplate.) | |
| CheckIn |
This method checks in (commits) all the changes to the object by saving
the information to persistent storage.
(Inherited from AFElementTemplate.) | |
| CheckOut |
This method locks the object so that its configuration can be modified.
(Inherited from AFElementTemplate.) | |
| CompareTo(Object) |
Compares this instance with a specified Object.
(Inherited from AFObject.) | |
| CompareTo(AFObject) |
Compares this instance with a specified AFObject.
(Inherited from AFObject.) | |
| CreateDefaultPorts |
This method can be used to create the default connection ports based upon the
element's type.
(Inherited from AFElementTemplate.) | |
| 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 or its template.
| |
| FindDerivedTemplates |
This method returns the collection of AFElementTemplate objects that
have this template as their base template.
(Inherited from AFElementTemplate.) | |
| FindInstantiatedElements(Boolean, AFSortField, AFSortOrder, Int32) |
This method returns a non-paged collection of AFBaseElement objects that were
created with this template.
(Inherited from AFElementTemplate.) | |
| FindInstantiatedElements(Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32) |
This method returns a paged collection of AFBaseElement objects that were
created with this template.
(Inherited from AFElementTemplate.) | |
| FindNotificationTemplate(PISystem, Guid) |
Retrieves the AFNotificationTemplate object with the specified unique identifier
at the AFTime.MaxValue query date.
| |
| FindNotificationTemplate(PISystem, Guid, Object) |
Retrieves the AFNotificationTemplate object with the specified unique identifier
at the specified query date.
| |
| GetAllAnalysisTemplates |
Gets the list of analysis templates for this template and all base templates.
(Inherited from AFElementTemplate.) | |
| GetAllAttributeTemplates |
Gets the list of top-level attribute templates for this template and all base templates.
(Inherited from AFElementTemplate.) | |
| GetAllCategories |
Gets the list of categories for this template and all base templates.
(Inherited from AFElementTemplate.) | |
| GetAllCategoriesString |
Gets the list of categories for this template and all base templates.
(Inherited from AFElementTemplate.) | |
| GetAllNotificationRuleTemplates |
Gets the list of AFNotificationRuleTemplate objects for this template and all base templates.
(Inherited from AFElementTemplate.) | |
| GetAllPorts |
Gets the list of ports for this template and all base templates.
(Inherited from AFElementTemplate.) | |
| GetAttributeTemplateByTrait |
Retrieves the child AFAttributeTemplate with the specified AFAttributeTrait.
(Inherited from AFElementTemplate.) | |
| GetAttributeTemplatesByTrait |
Retrieves a list of child AFAttributeTemplate objects identified by the specified list of attribute traits.
(Inherited from AFElementTemplate.) | |
| 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.
(Inherited from AFElementTemplate.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IsTypeOf |
Checks if the current AFElementTemplate is derived from the
specified base element template.
(Inherited from AFElementTemplate.) | |
| 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.
(Inherited from AFElementTemplate.) | |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) | |
| 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.
(Inherited from AFElementTemplate.) |
Events
| Name | Description | |
|---|---|---|
| Changed |
Event is raised when the object or one of its sub-objects is changed.
(Inherited from AFElementTemplate.) |
Remarks
This type of template is used to create an AFNotification and define its additional fields that are not present in an AFBaseElement. The AFElementTemplate is used to create the other types of AFBaseElement objects.
In addition to the fields and collections defined by the AFElementTemplate for the created AFNotification, this template also defines several additional fields specific to a notification (i.e. Priority, ResendInterval, etc.). It also specifies an NotificationContacts collection to be used to create the AFNotificationContact collection and the AFAnalysisTemplate to be used to create an AFAnalysis for the new notification. A collection of Contents is also defined by the template.
Use one of the AFNotifications.Add Overload methods to create a new AFNotification object. Use the PISystem.Supports method to check if the PISystem supports the NotificationTemplate 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.