I am trying to update a recurring calendar list instance, when i update the first time it all works fine but when i fetch the updated item and try to update it, than it does not get updated.

Here is the code i have done to update a recurring item

//fetch List item, in my case it will be exact one item per day
list = web.Lists["Calendar"];

SPQuery query1 = new SPQuery();query1.Query = string.Concat(
//Today"<Where><DateRangesOverlap>","<FieldRef Name='EventDate' />","<FieldRef Name='EndDate' />","<FieldRef Name='RecurrenceID' />","<Value type='DateTime'>","<Today/>","</Value>","</DateRangesOverlap>",

query1.ExpandRecurrence = true;
query1.CalendarDate = DateTime.Parse(txtCalendarDate.Text);

//as only one item is fetched updated the fetched item
SPListItem Newitem = list.Items.Add();

                        //The guid of the  recurrence item id
                        string uid_old = Convert.ToString(items[0]["UID"]);
                        Newitem["UID"] = new Guid(uid_old);

                        Newitem["Title"] = ttl;
                        Newitem["Location"] = ttl;

                        //Override the EventDate and EndDate
                        Newitem["EventDate"] = startdate;//Same date as item fetched but different time
                        Newitem["EndDate"] = Enddate;//Same date as item fetched but different time

                        //Set new item as recurrence item
                        Newitem["Recurrence"] = 1;

                        // recurrence item’s ID
                        int masterID;
                        if (Convert.ToString(items[0]["MasterSeriesItemID"]) == "" || Convert.ToString(items[0]["MasterSeriesItemID"]) == "0")
                            masterID = items[0].ID;
                            masterID = Convert.ToInt32(items[0]["MasterSeriesItemID"]);
                        Newitem["MasterSeriesItemID"] = masterID;

                        //Take recurrence item’s EventDate as RecurrenceID
                        Newitem["RecurrenceID"] = Convert.ToDateTime(items[0]["EventDate"].ToString());

                        Newitem["fRecurrence"] = 1;
                        Newitem["fAllDayEvent"] = 0;
                        Newitem["TimeZone"] = items[0]["TimeZone"].ToString();// What ever is the time zone.
                        //4 for override the recurrence item
                        Newitem["EventType"] = 4;

                        Newitem["RecurrenceData"] =  Convert.ToString(items[0]["RecurrenceData"]);


Can anyone help me figure out why the update is not working the second time i try to update? The updated entry is fetched properly, but it does not update it. The 1st time updated entry remains as it is and can be seen in Current Events in All Events another entry gets created but it is not reflected in the recurring item and during the same day if i try to fetch the entry than the 1st time updated entry is fetched.

Please refer image: enter image description here

1 Answer 1


Since MasterSeriesItemID wont be blank for already updated item we can update the same item and not create a new item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.