Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate Item has Recurrence in SharePoint
    text
    copied!<p>I had an event list. I created a new item that has recurrence daily ( Start Time : 1/5/2010 12 : 00 AM and End Time : 5/30/2010 12:00 AM). I want to delete the item which has Start Time : 5/12/2010 12:00 AM but my application throwed exception.</p> <p>My code as below : </p> <pre><code> DateTime eventDate = DateTime.Parse(list.Fields.GetFieldByInternalName("EventDate").GetFieldValueAsHtml(DateTime.Parse(this.DateTimeOfItem).ToUniversalTime())); SPQuery pQuery = new SPQuery(); pQuery.ExpandRecurrence = true; pQuery.CalendarDate = eventDate.AddDays(-1); pQuery.Query = string.Format("&lt;OrderBy&gt;&lt;FieldRef Name=\"EventDate\"/&gt;&lt;/OrderBy&gt;&lt;Where&gt;&lt;And&gt;&lt;DateRangesOverlap&gt;&lt;FieldRef Name=\"EventDate\" /&gt;&lt;FieldRef Name=\"EndDate\" /&gt;&lt;FieldRef Name=\"RecurrenceID\" /&gt;&lt;Value Type=\"DateTime\"&gt;&lt;Week /&gt;&lt;/Value&gt;&lt;/DateRangesOverlap&gt;&lt;Eq&gt;&lt;FieldRef Name=\"ID\" /&gt;&lt;Value Type=\"Counter\"&gt;{0}&lt;/Value&gt;&lt;/Eq&gt;&lt;/And&gt;&lt;/Where&gt;", this.ID); SPListItemCollection itemColl = list.GetItems(pQuery); int index = 0; while (index &lt; itemColl.Count) { SPListItem item = itemColl[index]; if (DateTime.Parse(item["EventDate"].ToString()).CompareTo(eventDate) == 0) { web.AllowUnsafeUpdates = true; item["UID"] = Guid.NewGuid().ToString(); item["EventType"] = 3; item["RecurrenceID"] = eventDate; item["MasterSeriesItemID"] = this.ID; item["XMLTZone"] = null; item["RecurrenceData"] = "Every 1 day(s)"; item.Update(); list.Update(); web.AllowUnsafeUpdates = false; break; } index++; } </code></pre> <p>I do not know why I can not update this item. Please help me.</p> <p>Thanks </p> <p>PD.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload