public static void DeleteValues(PIPoint piPoint, AFTime st, AFTime et, bool forceUpdateValuesMethod = false) { var timerange = new AFTimeRange(st, et); if (piPoint.Server.Supports(PIServerFeature.DeleteRange) && forceUpdateValuesMethod == false) { var errors = piPoint.ReplaceValues(timerange, new List <AFValue>()); if (errors != null && errors.HasErrors) { _logger.Error(errors.Errors); _logger.Error(errors.PIServerErrors); } } else { // fallback on the old fashion way of doing the delete // if code goes here this may be much slower to delete the values. _logger.Warn("The ReplaceValues method is not implemented on the target PI DataArchive or the forceUpdateValuesMethod flag was used, falling back to the previous longer method ( read and remove)"); var dataToDelete = piPoint.RecordedValues(timerange, AFBoundaryType.Inside, string.Empty, false); if (dataToDelete.Count > 0) { piPoint.UpdateValues(dataToDelete, AFUpdateOption.Remove); } } }