/// <summary> /// An item was updated. /// </summary> public override void ItemUpdated(SPItemEventProperties properties) { String workBoxURL = properties.ListItem.WBxGetAsString(WBColumn.WorkBoxURL); if (!String.IsNullOrEmpty(workBoxURL)) { using (WorkBox workBox = new WorkBox(workBoxURL)) { workBox.ReferenceDate = (DateTime)properties.ListItem["EventDate"]; if (workBox.Item.WBxColumnExists("EventDate")) { workBox.Item["EventDate"] = properties.ListItem["EventDate"]; } if (workBox.Item.WBxColumnExists("EndDate")) { workBox.Item["EndDate"] = properties.ListItem["EndDate"]; } workBox.JustUpdate(); workBox.UpdateCachedDetails(); } } base.ItemUpdated(properties); }
/// <summary> /// An item was deleted. /// </summary> public override void ItemDeleting(SPItemEventProperties properties) { String workBoxURL = properties.ListItem.WBxGetAsString(WBColumn.WorkBoxURL); if (!String.IsNullOrEmpty(workBoxURL)) { using (WorkBox workBox = new WorkBox(workBoxURL)) { // We're doing this like this in order trigger an asynchronous closure of the work box: workBox.Item.WBxSet(WBColumn.WorkBoxStatusChangeRequest, "Close"); workBox.JustUpdate(); } } base.ItemDeleted(properties); }