AFAdmin.DeleteOrphans Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Deletes orphan objects in the PISystem.
Namespace: OSIsoft.AF.Diagnostics
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static void DeleteOrphans( PISystem system, int delayMinutes )
Public Shared Sub DeleteOrphans ( system As PISystem, delayMinutes As Integer ) Dim system As PISystem Dim delayMinutes As Integer AFAdmin.DeleteOrphans(system, delayMinutes)
public: static void DeleteOrphans( PISystem^ system, int delayMinutes )
static member DeleteOrphans : system : PISystem * delayMinutes : int -> unit
Parameters
- system
- Type: OSIsoft.AFPISystem
The operation will be performed on the specified PISystem. - delayMinutes
- Type: SystemInt32
Specify the number of minutes to delay before a modified orphaned object is deleted. The value should be greater or equal to zero.
Exceptions
| Exception | Condition |
|---|---|
| SecurityException | This exception is thrown when attempting to execute without Admin security rights. |
| ArgumentNullException | This exception is thrown when attempting to execute on a PISystem that is null or deleted. |
| NotSupportedException | This exception is thrown when attempting to execute on a PISystem that does not support the AdminFunctionality feature. |
| ArgumentOutOfRangeException | Thrown when the delayMinutes is less than zero. |
Remarks
This method is used to delete objects in the PISystem that have been orphaned. This includes any AFElement objects that don't have a Parent defined.
Use the PISystem.Supports method to check if the PISystem supports the AdminFunctionality feature.
| Requires the Admin right to execute. |
| This method will error on servers before AF 2018 R2 (2.10.5). |