Search code examples
exchange-serverexchangewebservicesews-managed-apioffice365

Experiences on EWSMA and Exchange Online Office 365


Does anyone have experiences using Exchange Managed Webservices and Exchange Online (Office 365)

Are there Breaking Changes between a normal Exchange and the online? May I take the normal api for this ?

Any hints?


Solution

  • first of all it's important to know that O365 is currently running Exchange Server 2010 Service Pack 1 what has to be specified when using Exchange Managed API.

    The exchange autodiscover is done by a centralized exchange cluster, so you have to enable the redirection here.

    var service = new ExchangeService(ExchangeVersion.Exchange2010_SP1)
    {
       Credentials = new WebCredentials("MyO365UserId", "Password")
    };
    
    service.AutodiscoverUrl("foo@bar.onmicrosoft.com", delegate { return true; });
    var allContactsFromO365 = service
       .FindItems(WellKnownFolderName.Contacts, new ItemView(99));
    
    foreach (var contact in allContactsFromO365
                .Where(item => item as Contact != null)
                .OfType<Contact>())
    {
         Console.WriteLine(contact.DisplayName);
    }
    

    Hope that helps a little bit.

    So as you can see it's regular managed API code..

    have fun