创建约会的EWS得到了401未经授权的错误

时间:2012-11-07 23:37:36

标签: exchangewebservices

有人知道为什么我在调用EWS Web服务URL创建约会项目时会收到​​401未经授权的错误吗?我可以得到service.AutodiscoverUrl运行正常,但在保存约会项目时,它会出错。

我正在使用outlook10,Exchange 2010和EWS v2.0,这是我的代码:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);

ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
                ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
service.Credentials = new WebCredentials("myemail", "mypassword", "mydomain.com"); 
    service.Url = new Uri("https://myEWSDomain/EWS/Exchange.asmx");
    service.AutodiscoverUrl("myemail", RedirectionUrlValidationCallback2);

Appointment appointment = new Appointment(service);
appointment.Subject = "Testing";
appointment.Start = DateTime.Now;
appointment.End = appointment.Start.AddHours(1);
appointment.RequiredAttendees.Add("user@test.com");
appointment.Save(SendInvitationsMode.SendOnlyToAll);

任何帮助都是值得赞赏的。

感谢

回声

0 个答案:

没有答案