Hi,
I'm using EWS API 2.0 version with Microsoft Exchange Server 2019 and 2010 SP2 (on-premise setup).
I have an application which subscribe 'WellKnownFolderName.Calendar' folder of email boxes using Streaming Notification. In the initial call, I send SyncState value to empty to get all the appointments from calendar for below event types.
EventType.Created, EventType.Modified, EventType.Moved, EventType.Deleted
With this setup, when I first time subscribe for a mailbox, it does not retrieve all the old data. That is, if I start my subscription today, it generally retrieves data onwards this month or last month (there is no exact range).
I need all the appointments available in mailbox, I’m not considering the archived one. At least the appointments those are currently present in mailbox need to be sync.
My questions:
- How much past data will come-up in the initial call ?
- Is there any range or limit ?
- Can I get past appointments, say after X date or from X to Y date?
I did lot of research on web, gone through MS documents, blogs and what not. I did not find a clue how much past data it will retrieve. Usually MS doc says it retrieves all appointment and suggest to use code like below, but it does not retrieve all appointment, and recommended code is already in place.
Here is my sample code:
private void SampleCode()
{
var moreChangesAvailable = true;
var syncState = string.Empty;
while (moreChangesAvailable)
{
var changeCollection = exchangeService.SyncFolderItems(
WellKnownFolderName.Calendar,
PropertySet.IdOnly,
null,
10,
SyncFolderItemsScope.NormalItems,
syncState);
// Internal method to process items retrieved from exchange
ProcessCollection(changeCollection);
syncState = changeCollection.SyncState;
moreChangesAvailable = changeCollection.MoreChangesAvailable;
}
}
Can someone please help with this ?
Please do the needful.
Thanks in advance.