Method DeleteItemEx | |
Syntax: | Boolean = object.DeleteItemEx ( nDisposition ) |
Parameters: |
nDisposition
As TrkItemDeleteDisposition
-
|
Description: | Deletes a list of items matching the criteria specified in the Item Agent Object. Set the criteria to find a list of items that need to be deleted, such as Item IDs, ProjectIDs etc. Call ItemAgent.DeleteItemEx Method to delete ALL items matching the criteria. Note: There is no need to call ItemAgent.Execute before calling DeleteItemEx. Item IDs can be set in a single comma-saperated string (e.g. "ITEM1,ITEM2,ITEM3") or in a loop by assigning to ItemAgent.ItemID (e.g. ItemAgent.ItemID = sItemID(iCounter) ) See the example for more details. Example 1: Delete a particular item Dim iAgent As Object, iItems as Object, iItem as
Object Set iAgent = CreateObject("Tracker.TrkItemAgent") iAgent.ItemID = "M0110" If iAgent.DeleteItemEx(TrkItemDeleteDisposition.enumSCRAP) =
True Then MsgBox
"Deleted" MsgBox
"Delete Failed" Set iAgent = Nothing Example 2: Delete items specified in a comma saperated list Dim iAgent As Object, iItems as Object, iItem as
Object Set iAgent = CreateObject("Tracker.TrkItemAgent") iAgent.ItemID = "M0110,M0111,M0112,M0113" If iAgent.DeleteItemEx(TrkItemDeleteDisposition.enumSCRAP) =
True Then MsgBox
"Deleted" MsgBox
"Delete Failed" Set iAgent = Nothing Example 2: Delete items specified in a loop Dim iAgent As Object, iItems as Object, iItem as
Object Set iAgent = CreateObject("Tracker.TrkItemAgent") For i = 1000 to 1010 iAgent.ItemID = "M" & Format(i, "0000") If iAgent.DeleteItemEx(TrkItemDeleteDisposition.enumSCRAP) =
True Then MsgBox
"Deleted" MsgBox
"Delete Failed" Set iAgent = Nothing |