I was trying to delete PI Data Archive events for a tag with PI AF SDK. All the code got executed, but I found out that the events were still existed within the PI Data Archive upon checking with PI SMT Archive editor. However, after waiting a couple of minutes, all the events for the specified tag got deleted between the time range. I could put sleep method before continue, but is there a method to use to make sure all the events for a tag were deleted before continue execute to the next tag? Thank you.
PIServer server = new PIServers()["PISERVERNAME"];
PIPoint tag = PIPoint.FindPIPoint(server, "TAGNAME");
AFTimeRange timeRange = new AFTimeRange("StartTime", "EndTime");
AFValues tagValues = tag.RecordedValues(timeRange, OSIsoft.AF.Data.AFBoundaryType.Inside, "", false, Int32.MaxValue);
List<AFValue> list = new List<AFValue>();
foreach (AFValue tagValue in tagValues)
Message was edited by: Ricky Sun