First published on TECHNET on Mar 25, 2013
This blog post is a contribution from Kevin Jacob Kurian, an engineer with the SharePoint Developer Support team.
When we edit a single instance of a recurring event, it actually creates a new instance of the event and deletes the old one. The old instance is deleted by setting certain attributes of that particular instance. This is per design.
Here’s an example of deleting a single instance of a recurring event:
SPListItem deleting_item = list.Items.Add();
deleting_item["MasterSeriesItemID"] = olditem.ID;
deleting_item["UID"] = olditem[“UID”];
// EventType is the attribute that defines that this event is to be deleted
deleting_item["EventType"] = 3;
// fRecurrence identifies that the event is a recurring event
deleting_item["fRecurrence"] = 1;
deleting_item["fAllDayEvent"] = olditem["fAllDayEvent"];
deleting_item["EventDate"] = olditem["EventDate"];
deleting_item["EndDate"] = olditem["EndDate"];
// Set RecurrenceID this to the date of the event instance you want to delete
deleting_item["RecurrenceID"] = olditem["EventDate"];
// the “Deleted:” keyword is required in the Title of the deleting instance
deleting_item["Title"] = "Deleted: " + olditem["Title"].ToString();
deleting_item.Update();
list.Update();
deleting_item["MasterSeriesItemID"] = olditem.ID;
deleting_item["UID"] = olditem[“UID”];
// EventType is the attribute that defines that this event is to be deleted
deleting_item["EventType"] = 3;
// fRecurrence identifies that the event is a recurring event
deleting_item["fRecurrence"] = 1;
deleting_item["fAllDayEvent"] = olditem["fAllDayEvent"];
deleting_item["EventDate"] = olditem["EventDate"];
deleting_item["EndDate"] = olditem["EndDate"];
// Set RecurrenceID this to the date of the event instance you want to delete
deleting_item["RecurrenceID"] = olditem["EventDate"];
// the “Deleted:” keyword is required in the Title of the deleting instance
deleting_item["Title"] = "Deleted: " + olditem["Title"].ToString();
deleting_item.Update();
list.Update();
HTH!
Updated Sep 01, 2020
Version 3.0SPDev_Support
Microsoft
Joined April 30, 2019
Microsoft SharePoint Blog
Welcome to the SharePoint Blog! Learn best practices, news, and trends directly from the SharePoint team.