Answered by:
[EWS][Exchange-Online][EWSMA] Since some Office 365 update the SyncFolderItems(..) function for public folders doesn't work correct anymore

Question
-
ServerInfo: {15.01.1101.019} V2017_04_14
Hi,
I just asked the Office 365 support for this problem, but they gave me this link in order to ask for fixing this problem here.
If I call the function SyncFolderItems(..) on a public calendar folder starting with empty status, everything works fine until I delete some appointment in the folder. Then I get an exception on calling that function, saying "An internal server error occurred. The operation failed"
I made some code in order to reproduce the error:
Please run this code and while it is running delete some appointment in your public calendar folder.
ExchangeService service = new ExchangeService (ExchangeVersion.Exchange2016, TimeZoneInfo.Local); service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx"); service.Credentials = new WebCredentials("x.y@germany.de", "pwd"); Folder f1 = Folder.Bind(service, new FolderId("SOMEFOLDERID OF A PUBLIC CALENDAR FOLDER"), BasePropertySet.FirstClassProperties); Console.WriteLine(f1.DisplayName); String status = ""; do { ChangeCollection<ItemChange> changes = service.SyncFolderItems(f1.Id, BasePropertySet.IdOnly, null, 100, SyncFolderItemsScope.NormalItems, status); Console.Write(changes.Count+","); status = changes.SyncState; } while (true);
- Edited by Somebytes Monday, May 29, 2017 9:38 AM
Monday, May 29, 2017 9:37 AM
Answers
-
They changed the version to (V2017_04_14) 15.01.1178.021, which solved the problem for me.
- Marked as answer by Somebytes Tuesday, June 20, 2017 9:03 AM
Tuesday, June 20, 2017 9:03 AM
All replies
-
I can confirm that I have the same problem - and wish to log it.
I have a service for customers which has been running fine for 18months + but on Monday 22nd May two separate customer's folder sync started showing the error: "An internal server error occurred. The operation failed". The common factor is using EWS with Office 365 to retrieve items from a Public Folder Calendar using the service.SyncFolderItems call.
I have now reproduced it on my own system. Passing updated syncStatus values to service.SyncFolderItems works fine when adding items to the calendar. As soon as an item is deleted from the calendar, it fails.
I can get it to work again by resetting the syncStatus to null and retrieving a full set of updates, but of course this does not include an update for the item that has been deleted.Building Outlook and Exchange solutions using Outlook plugins, Office 365 add-ins, Exchange Web Services, and Office Graph
Monday, May 29, 2017 11:39 AM -
Note: This is only an issue for Public Folders. It seems to work fine for standard Office 365 Mailbox Calendar folders.
Building Outlook and Exchange solutions using Outlook plugins, Office 365 add-ins, Exchange Web Services, and Office Graph
Monday, May 29, 2017 11:48 AM -
The sync seems to be working fine in Shared Mailbox Calendar folders as well as ordinary Mailbox calendars. So the issue is just with Public Folders. In the short term, I will be suggesting to my customers that they might migrate their public folders to a shared mailbox (which Microsoft would prefer as well I think).
Note: I can use delegated EWS access to reach a shared Calendar. If I have credentials for a mailbox which has access to the shared Calendar, I use those credentials and the email address of the shared mailbox as the delegated mailbox.
Building Outlook and Exchange solutions using Outlook plugins, Office 365 add-ins, Exchange Web Services, and Office Graph
Monday, May 29, 2017 12:30 PM -
In between the versionnumber has changed to ServerInfo: {15.01.1124.013} V2017_04_14
The behavior is the same.
Also I noticed another thing. If you ask the SyncFolderItems() by only BasePropertySet.IdOnly you get no changes in the first time (syncstate=null) but the servererror after deleting remains the same. So you have to ask one more property in order to get changes in the first time.
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2016, TimeZoneInfo.Local); service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx"); service.Credentials = new WebCredentials("xyz", "geheim"); Folder f1 = Folder.Bind(service, new FolderId("some id of a public calendar folder",BasePropertySet.FirstClassProperties); Console.WriteLine(f1.DisplayName); Console.WriteLine(service.RequestedServerVersion.ToString()); Console.WriteLine(service.ServerInfo); Console.WriteLine(service.ServerInfo.VersionString); String status = null; ChangeCollection<ItemChange> changes=null; do { try { changes = service.SyncFolderItems(f1.Id, new PropertySet(BasePropertySet.IdOnly,ItemSchema.LastModificationTime), null, 100, SyncFolderItemsScope.NormalItems, status); } catch(Exception ex) { Console.WriteLine(); Console.WriteLine(ex.Message); Console.WriteLine(); } if (changes.Count > 0) { foreach(ItemChange c in changes) Console.Write(c.ChangeType.ToString()+","); Console.Write(changes.Count); } status = changes.SyncState; } while (true);
- Edited by Somebytes Thursday, June 1, 2017 6:49 AM forgot to add the second property in the SyncFolderItems function
Thursday, June 1, 2017 6:41 AM -
It's now two weeks later... The version has changed to 15.01.1157.012.
The error still exists.
Friday, June 9, 2017 1:13 PM -
They changed the version to (V2017_04_14) 15.01.1178.021, which solved the problem for me.
- Marked as answer by Somebytes Tuesday, June 20, 2017 9:03 AM
Tuesday, June 20, 2017 9:03 AM