AFNotificationRule.SetStatus Method (AFDatabase, AFObject, AFStatus, AFStatus)
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Sets all the AFNotificationRule objects based upon a filter object to the specified status.
Namespace: OSIsoft.AF.Notification
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static void SetStatus( AFDatabase database, AFObject filter, AFStatus newStatus, AFStatus oldStatus = AFStatus.None )
Public Shared Sub SetStatus ( database As AFDatabase, filter As AFObject, newStatus As AFStatus, Optional oldStatus As AFStatus = AFStatus.None ) Dim database As AFDatabase Dim filter As AFObject Dim newStatus As AFStatus Dim oldStatus As AFStatus AFNotificationRule.SetStatus(database, filter, newStatus, oldStatus)
public: static void SetStatus( AFDatabase^ database, AFObject^ filter, AFStatus newStatus, AFStatus oldStatus = AFStatus::None )
static member SetStatus : database : AFDatabase * filter : AFObject * newStatus : AFStatus * ?oldStatus : AFStatus (* Defaults: let _oldStatus = defaultArg oldStatus AFStatus.None *) -> unit
Parameters
- database
- Type: OSIsoft.AFAFDatabase
The AFDatabase to search for the requested objects. - filter
- Type: OSIsoft.AFAFObject
The object to be used to filter the AFNotificationRule to have their Status set to the specified newStatus value. Specify to set the status for all AFNotificationRule objects within the database. The filtered AFNotificationRule can be limited by the oldStatus parameter if specified.
The following types of filter objects can be specified:
Object Type Description AFNotificationRuleTemplate The status for all AFNotificationRule with the specified template will be set. Specify None as the filter for AFNotificationRule objects with no template. AFCategory The status for all AFNotificationRule objects with the specified category will be set. Specify None as the filter for AFNotificationRule objects with no categories. - newStatus
- Type: OSIsoft.AF.AnalysisAFStatus
The new AFStatus for the AFNotificationRule objects. - oldStatus (Optional)
- Type: OSIsoft.AF.AnalysisAFStatus
The old AFStatus for the AFNotificationRule objects that are to be updated. Only AFNotificationRule objects with the specified old status will be updated. To update all AFNotificationRule objects not having the newStatus, then specify None for this parameter.
Exceptions
| Exception | Condition |
|---|---|
| NotSupportedException | This exception is thrown when calling this method and connected to an AF 2.6 or earlier server or if an unsupported filter is specified. |
Remarks
This method will set all the AFNotificationRule based upon a filter object to the same AFStatus in a single
call to the server. If the optional oldStatus is specified, then only AFNotificationRule that match the
old status will be updated.
This is more efficient than setting the Status property of each AFNotificationRule.