2

有人知道为什么我在调用 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);

非常感谢任何帮助。

谢谢

回声

4

0 回答 0