question

AshishVora-7628 avatar image
0 Votes"
AshishVora-7628 asked GlenScales-6756 answered

EWS 2.0 - Initial Synchronization with MS Exchange Server 2019 and 2010 - Past Data Sync Problem

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:

  1. How much past data will come-up in the initial call ?

  2. Is there any range or limit ?

  3. 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.




office-exchange-server-connectivityoffice-exchange-server-devoffice-exchange-server-ha
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AshishVora-7628
Hi,
Based on your description, your question is about EWS development.
Due to here we mainly focus on general issues on Exchange servers, it is recommended to post a new thread in this forum:
Exchange Server Development

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
Thanks for your understanding and hope your problem will be resolved soon.


0 Votes 0 ·

Yes, MS Support given me the same link to post a question but this link is archived now and posting the question there is automatically marked as 'Spam'. Opening that link shows the below message, and opening Microsoft Q&A link redirects to this forum. Have a look at the below message opening the link given by you.

51866-image.png


Please let me know if there is any other active forum for Exchange related issue.

0 Votes 0 ·
image.png (23.9 KiB)

Hi,
Sorry for all the confusion and inconvenience caused.

I have added the "office-exchange-server-dev" tag to your question.
It should post your question on the new exchange development forum here on Microsoft Q&A.
Thanks for your understanding and hope you will get the answer soon.

1 Vote 1 ·

Can someone answer this please ? I am very much surprised that there is no response after many months, may be I have posted in wrong forum ? Please suggest.

Thanks,
Ashish

0 Votes 0 ·

1 Answer

GlenScales-6756 avatar image
0 Votes"
GlenScales-6756 answered

SyncFolderItems doesn't do a Calendar Expansion query so if you have recurring appointments these won't be expanded, you can use it to track when the Masters are modified for your 1,3 questions it not going to return a full list of appointments like a FindItems with a CalendarView would. It makes Calendar Sync logic unfortunately pretty complicated (they did some work in the Graph https://docs.microsoft.com/en-us/graph/delta-query-events?tabs=http to make thing easier but it seems your using OnPrem).

The easiest sync logic is to use FindItem with a CalendarView for the time windows you want to sync and then use Streaming notifications to trigger a query anytime it detects a change in the Calendar (not the most efficient though but it reliable). Other things you can do is read the recurrence blob and do your own expansion logic



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.