private static String url ="https://myemail.com/ews/exchange.asmx";
private static String username="user@email.com";
private static String password="user@123";
private static String domain="Dir";
public class service{
ExchangeService exchangeService = null;
exchangeService = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
exchangeService.setUrl(new URI(EmailService.url));
ExchangeCredentials credentials = new WebCredentials(username, password,domain);
exchangeService.setCredentials(credentials);
FindItemsResults<Item> results = null;
try {
String getFolderId = null;
Folder rootfolder =
Folder.bind(service,WellKnownFolderName.MsgFolderRoot);
rootfolder.load();
}
}
我正在尝试使用上面的代码连接到Web服务器我得到例外,因为, microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException:请求失败。仍然分配了连接