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.</p><p>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>","</Where>");
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
// recurrence item’s ID
int masterID;
if (Convert.ToString(items[0]["MasterSeriesItemID"]) == "" || Convert.ToString(items[0]["MasterSeriesItemID"]) == "0")
masterID = items[0].ID;
else
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"]);
Newitem.Update();
list.Update();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:
http://social.msdn.microsoft.com/Forums/getfile/185919
Please Help ME~