我正在使用ewsjavaapi 1.1.5。我正在尝试使用无效的凭据登录,但我没有任何例外。
请建议如何检测和处理无效的登录。
这是我的代码:
String host = "myhost";
ExchangeService service = null;
try {
service = new ExchangeService();
ExchangeCredentials credentials = new WebCredentials("wrongemail",
"wrongpass");
service.setCredentials(credentials);
service.setUrl(new java.net.URI("https://" + host
+ "/EWS/Exchange.asmx"));
} catch (Exception e) {
e.printStackTrace();
}
找到了它,我必须将服务绑定到文件夹:
Folder.bind(service, WellKnownFolderName.Inbox);
如果凭据是错误的, httperrorexception 被抛出。