开发者

Why does EWS Managed API SyncFolderItems not return recurring appointments

I'm using the managed API of EWS to synchronize a scheduling application with exchange calendars. I get all normal meetings fine, but I am not getting any repeating/recurring appointments.

My code follows:

itemChangeCollection = _s开发者_运维百科ervice.SyncFolderItems(
                            new FolderId(WellKnownFolderName.Calendar,
                                         new Mailbox(Email)),
                            propertySet,
                            null,
                            Settings.Default.ExchangeSyncFetchCount,
                            SyncFolderItemsScope.NormalItems,
                            syncState);

What do I need to change to see the recurring appointments as well?


Instances of recurring appointments are not "real" items in the store. They are virtual in the sense that they are calculated whenever you perform a search with a calendar view and a timeframe.

The only way to find recurring appointments is to use the FindItems method.


SyncFolderItems only returns the necessary information to reconstruct a recurring serie but does not expand the individual occurrences. If you need expanded occurrences you need to use the FindItems method.

However, even assuming you can expand the recurrence yourself, SyncFolderItems alone does not provide all the necessary information.

SyncFolderItems will return a list of events with Single or RecurringMaster AppointmentType. A RecurringMaster event contains the ModifiedOccurrences and DeletedOccurrences properties. Unfortunately the items in ModifiedOccurrences only contains the ItemId, not the Item itself. It seems necessary to solve all exception separately to get the fields of modified occurrences. From the documentation:

Each OccurrenceInfo object in the ModifiedOccurrences collection contains four properties: End, ItemId, OriginalStart, and Start. To access additional properties on the exception item, you must bind to the item by using the OccurrenceInfo.ItemId.

foreach (OccurrenceInfo item in recurringMasterItem.ModifiedOccurrences)
{
   Appointment modifiedItem = Appointment.Bind(service, item.ItemId);
   Console.WriteLine("Subject: " + modifiedItem.Subject);
}

In other words, with the data you get from SyncFolderItem you can expand a recurrence, including time exceptions and deleted occurrences but you would have to resolve exceptions on other fields (ie. summary, body, location. etc) with additional .Bind() calls.


SyncFolderItems will give you the recurring master items, but does not expand them into occurrences. The recurring master holds the common properties for all items, the recurring pattern and a list of exceptions and deletions. This is all the information required to expand them to occurrences. Although you are supposed to call Appointment.BindToOccurrence to bind the properties for an individual occurrence from a recurring master based on an occurrence index. The downside is this makes an EWS call for each occurrence.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜