AFElement.DeleteElements Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Delete the objects with the specified unique identifiers.
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static void DeleteElements( PISystem system, IList<Guid> ids )
Public Shared Sub DeleteElements ( system As PISystem, ids As IList(Of Guid) ) Dim system As PISystem Dim ids As IList(Of Guid) AFElement.DeleteElements(system, ids)
public: static void DeleteElements( PISystem^ system, IList<Guid>^ ids )
static member DeleteElements : system : PISystem * ids : IList<Guid> -> unit
Parameters
- system
- Type: OSIsoft.AFPISystem
The PISystem containing the objects to be deleted. - ids
- Type: System.Collections.GenericIListGuid
A list of the unique identifiers of the objects to be checked out.
Remarks
This method will delete the objects in the specified list of ids with out requiring a checkout of the object. If the object is already checked out by another user the specified object will still be deleted.
This method will delete all references, including sandbox, to any object specified in the list of ids where the user has Delete permission on the object.
Examples
// This example demonstrates how to use efficiently delete elements using // AFElementSearch and the DeleteElements method. // Get the Database PISystems myPISystems = new PISystems(); PISystem myPISystem = myPISystems.DefaultPISystem; AFDatabase myDB = myPISystem.Databases.DefaultDatabase; // Search for the elements to be deleted. using (var search = new AFElementSearch(myDB, "FindElements", @"Template:'MyTemplate'")) { search.CacheTimeout = TimeSpan.FromMinutes(10); // Get a list of IDs of elements to be deleted in pages of 100. foreach (IList<Guid> pageOfIds in search.FindObjectIds().ChunkedBy(100)) { AFElement.DeleteElements(myPISystem, pageOfIds); } }
' This example demonstrates how to use efficiently delete elements using ' AFElementSearch And the DeleteElements method. ' Get the Database Dim myPISystems As PISystems = New PISystems() Dim myPISystem As PISystem = myPISystems.DefaultPISystem Dim myDB As AFDatabase = myPISystem.Databases.DefaultDatabase ' Search for the elements to be deleted. Using search As New AFElementSearch(myDB, "FindElements", "Template:'MyTemplate'") search.CacheTimeout = TimeSpan.FromMinutes(10) ' Get a list of IDs of elements to be deleted in pages of 100. For Each pageOfIds As IList(Of Guid) In search.FindObjectIds().ChunkedBy(100) AFElement.DeleteElements(myPISystem, pageOfIds) Next End Using
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.