HOW TO: Programmatically delete a single instance of a recurring event in a SharePoint calendar
Published May 01 2019 03:40 PM 586 Views
Microsoft

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();



HTH!

Version history
Last update:
‎Sep 01 2020 02:23 PM
Updated by: