none
[EWS][Exchange-Online][EWSMA] Since some Office 365 update the SyncFolderItems(..) function gives me and many others "The operation failed., IdAndSession.MailboxSession: session is not IMailboxSession" RRS feed

  • Question

  • As mentioned here: stackoverflow.com/questions/48950767

    there is a new problem with Office 365 public folders function SyncFolderItems.

    It gives "The operation failed., IdAndSession.MailboxSession: session is not IMailboxSession" if you use the SyncFolderItems function.

    here is some testcode:

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2016);
    service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
            
    service.Credentials = new WebCredentials("albrecht@duerer.com", "pwd");
                 
    try
    {
        Folder publicfolder = Folder.Bind(service, WellKnownFolderName.PublicFoldersRoot, BasePropertySet.FirstClassProperties);
        var res = publicfolder.FindFolders(new FolderView(100) {  });
    
        service.ClientRequestId = "@MS Team: Please fix this error!!";
        service.UserAgent  = "@MS Team: Please fix this error!!";
    
        // Next line, the exception will come up.
        var changes = service.SyncFolderItems(WellKnownFolderName.PublicFoldersRoot, BasePropertySet.IdOnly, null, 10, SyncFolderItemsScope.NormalItems, "");
            
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex);
    }


    • Edited by Somebytes Monday, December 17, 2018 10:41 AM
    Monday, December 17, 2018 10:39 AM

Answers

  • Hi.

    Somebody has fixed the problem during the night.

    (Version is now: { 15.20.1446.019} V2018_01_08

    Thank you very much, this was very fast this time.

    Sven

    • Marked as answer by Somebytes Wednesday, December 19, 2018 6:58 AM
    Wednesday, December 19, 2018 6:58 AM

All replies

  • Hi SomeBytes,

    It seems to existed only in public folders? I tested with a public calender folder. And if I call SyncFolderItems for the first time with no status, run without error. But if I have a status and delete one item in the public folder, Then I got this error on the next call of SyncFolderItems().

    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);

    For more information, please refer to this link:

    EWS SyncFolderItems is giving me exception “An internal server error occurred

    Regards,

    Simon


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.


    Tuesday, December 18, 2018 9:24 AM
  • Hi Simon,

    Yes, you are right, it's only on public folders.

    I just tested with other foldertypes like Calender, but it will give this error on the first call.

    The link you attach is another problem, which is already fixed.

    Current ExchangeVersion: {15.20.1446.017} V2018_01_08

    Regards

    Sven


    • Edited by Somebytes Tuesday, December 18, 2018 12:54 PM
    Tuesday, December 18, 2018 10:05 AM
  • Hi.

    Somebody has fixed the problem during the night.

    (Version is now: { 15.20.1446.019} V2018_01_08

    Thank you very much, this was very fast this time.

    Sven

    • Marked as answer by Somebytes Wednesday, December 19, 2018 6:58 AM
    Wednesday, December 19, 2018 6:58 AM