read email using exchange web services

后端 未结 6 569
灰色年华
灰色年华 2021-01-05 01:43

This is my scenario: I have to read email from exchange 2010 sp2 accounts. I have to use Exchange Web Services, POP3 and IMAP are blocked. I have to test my app in an enviro

6条回答
  •  礼貌的吻别
    2021-01-05 02:22

    This is a old post I thought I'd put in a full example solution for the error reported. Simply replace service.AutodiscoverUrl("someuser@somedomain.org"); with System.Uri("https://mail.somedomain.org/ews/Exchange.asmx");

    Here's the full block of code

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
                    service.Credentials = new WebCredentials("someuser", "somepassword");
                    //service.AutodiscoverUrl("someuser@somedomain.org");
                    service.Url = new System.Uri("https://mail.somedomain.org/ews/Exchange.asmx");
    

提交回复
热议问题