Welcome to Office 365 APIs | Microsoft Docs
Skip to main content

Office 365 APIs

This site contains the documentation for Office 365 REST APIs exposed on the OneNote and Outlook endpoints. The documentation is no longer actively updated. It is here for your reference, in case you have already included any of the API in your project.

Office 365 services, such as OneNote, Outlook, Excel, OneDrive, Microsoft Teams, Planner, and SharePoint, are now exposed in Microsoft Graph. Microsoft Graph is a unified API endpoint for accessing data across Microsoft 365, which includes Office 365, Enterprise Mobility, and Security and Windows services. It provides a simplified developer experience, with one endpoint and a single authentication token that gives your app access to data across all these services.

Our recommendation:

  • If you are starting a new app, please use Microsoft Graph.
  • If you are maintaining an existing project, use this documentation set for reference. In addition, plan your move to the latest APIs in Microsoft Graph to take advantage of all the new functionality and innovation there.
  • If you are adding new functionality to an existing project, integrate that new functionality by using Microsoft Graph.

With Microsoft Graph, you can access Office 365 data and more, from solutions across mobile, web, and desktop platforms. So whether you're building web applications by using .NET, PHP, Java, Python, or Ruby on Rails, or creating apps for the Universal Windows Platform (UWP), iOS, Android, or on another device platform, it's your choice.

In this section

 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
Welcome to Office 365 APIs | Microsoft Docs
Skip to main content

Office 365 APIs

This site contains the documentation for Office 365 REST APIs exposed on the OneNote and Outlook endpoints. The documentation is no longer actively updated. It is here for your reference, in case you have already included any of the API in your project.

Office 365 services, such as OneNote, Outlook, Excel, OneDrive, Microsoft Teams, Planner, and SharePoint, are now exposed in Microsoft Graph. Microsoft Graph is a unified API endpoint for accessing data across Microsoft 365, which includes Office 365, Enterprise Mobility, and Security and Windows services. It provides a simplified developer experience, with one endpoint and a single authentication token that gives your app access to data across all these services.

Our recommendation:

  • If you are starting a new app, please use Microsoft Graph.
  • If you are maintaining an existing project, use this documentation set for reference. In addition, plan your move to the latest APIs in Microsoft Graph to take advantage of all the new functionality and innovation there.
  • If you are adding new functionality to an existing project, integrate that new functionality by using Microsoft Graph.

With Microsoft Graph, you can access Office 365 data and more, from solutions across mobile, web, and desktop platforms. So whether you're building web applications by using .NET, PHP, Java, Python, or Ruby on Rails, or creating apps for the Universal Windows Platform (UWP), iOS, Android, or on another device platform, it's your choice.

In this section