Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i have a calendar list and a task list. The calendar list has normal events and recurring events. I sync the events in the calender list to the tasklist with a modified version of this code:

// Get the Events list
SPSite site = new SPSite("http://localhost");
SPWeb web = site.RootWeb;
SPList calendarList = web.Lists["Calendar"];

// Construct a query that expands recurring events
SPQuery query = new SPQuery();
query.ExpandRecurrence = true;
query.Query = "<Where><DateRangesOverlap><FieldRef Name=\"EventDate\" /><FieldRef Name=\"EndDate\" /><FieldRef Name=\"RecurrenceID\" /><Value Type=\"DateTime\"><Month /></Value></DateRangesOverlap></Where>";

// Look forward from the beginning of the current month
query.CalendarDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

// Returns all items (including recurrence instances) that
// would appear in the calendar view for the current month
SPListItemCollection calendarItems = calendarList.GetItems(query);

foreach (SPListItem item in calendarItems)
{
Console.WriteLine(item["Title"] + ": starts "
+ item["EventDate"].ToString() + " and ends "
+ item["EndDate"].ToString());
}

Now i want to save the information "already synced" to prevent double entries in the task list.

To do this i can store the information "already synced" in the calender list item or in the task list item.

Here is my problem: Because the calender event is maybe a recurring event i have to break the recurrence to save this data and must create a recurrence exception.

For a daily recurring event this would create 365 entries for example instead of the original one recurring event. This sounds way to complicated.

The second idea: Instead of storing the information "already synced" in the calender list i could possibly store the unique identifier of a event in the created task list item.

First problem here: What is a unique identifier for a recurring event?

Second problem: If the unique identifier is RecurringID (a datetime value normally) what if the event recurrence is broken up by the user? Would the ReccuringID stay the same?

So in the end...

Can anybody jump onboard and help out?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.