据说用SPListItem.Delete不能删除, 偶也不知怎么删除,就看了下系统的实现代码,需要的朋友自己捉摸吧:
(此代码在Microsoft.SharePoint.WebControls.DeleteItemButton类中)
private void DeleteFromRecurrenceSeries() { if ((base.ItemContext.List.BaseTemplate == SPListTemplateType.Events) || ((base.ItemContext.ContentType != null) && base.ItemContext.ContentType.Id.IsChildOf(SPBuiltInContentTypeId.Event))) { while (true) { using (IEnumerator enumerator = base.ItemContext.FormContext.FieldControlCollection.GetEnumerator()) { Control control; RecurrenceField field; goto Label_0023; Label_001B: field.DeleteExceptionItem(); return; Label_0023: if (enumerator.MoveNext()) { goto Label_0036; } return; Label_002E: field.DeleteInstanceItem(); return; Label_0036: control = (Control) enumerator.Current; if (control is RecurrenceField) { goto Label_005C; } goto Label_0023; Label_004D: if (!base.ListItem.IsExceptionId) { return; } goto Label_001B; Label_005C: field = (RecurrenceField) control; if (!base.ListItem.IsInstanceId) { goto Label_004D; } goto Label_002E; } } } } |