Closed ujwalseli closed 7 years ago
The expander focuses on the date and time components. The tricky thing is that calendar entries can contain any attribute the user desired (by editing the list's column). Generic logic for carrying over these values wouldn't work.
Did you try the sample provided on the README page? It contains this user-provided mapper function:
Func<RecurrenceInstance, Appointment> toDomainObject = (ri => {
var a = collapsedAppointments.First(i => int.Parse(i["ID"].ToString()) == ri.Id);
return new Appointment {
Id = ri.Id,
Title = (string) a["Title"],
Start = ri.Start,
End = ri.End
};
});
Perhaps it can be adjusted to map columns in your domain.
I had tried that
Func<RecurrenceInstance, Appointment> toDomainObject = (ri => { var a = collapsedAppointments.First(i => int.Parse(i["ID"].ToString()) == ri.Id); return new Appointment { Id = ri.Id, Title = (string)a["Title"], Start = ri.Start, End = ri.End, Status = (string)a["Status"], Escalation = (bool)a["Escalation"], perComplete = (double)a["_x0025__x0020_Complete"], fRecurrence = (bool)a["fRecurrence"], RecurrenceData = (string)a["RecurrenceData"], AssignedTo = (FieldUserValue[])a["Assigned_x0020_To"], ReportsTo = (FieldUserValue)a["Reports_x0020_To"], Actions= (string)a["Actions"] }; });
Values for perComplete, Actions and Status is same for all expanded events, even if they are modified in SharePoint and have different values.
When an element making up the recurrence is modified, SharePoint turns it into a new list item and marks it as a recurrence exception with a pointer back to the master series. That item holds the modified values. That's how we currently get the exceptions for start and end time.
We know the time properties to always be present. We cannot assume "% complete" is always present. In addition, a user may have added fields on his own to be extracted. A more general solution would seem to require a custom mapper be passed with the call to
var recurrenceInstances = expander.Expand(collapsedAppointments);
Recurrence instances are currently of this type:
type RecurrenceInstance =
{ Id: int
Start: DateTime
End: DateTime }
Those are the hardcoded properties returned. With a custom mapper, we could add additional fields by mapping into a client-provided type. That, however, isn't a trivial change.
Would your company be willing to fund the development of such a feature?
thanks for the reply. We are currently querying the modified items separately via traditional CSOM approach as a workaround.
We wanted a confirmation whether this was supported by feature. Now that we have one, I need to check the company policies to see if a funding can be arranged.
I'll close this one for now. Feel free to reach out if company conditions change or if you wish to submit a pull request.
in continuation with #15 , I found that while iterating events in a recurring series, field values like Status, % complete etc. are not retrieved correctly( I always get 0% complete and not started, same values as parent series item).
it seems the changes made for individual events inside a recurring event are not captured and values retrieved are those of recurring event series.