我们使用EWS
Java API在
Java应用程序上使用outlook日历.我在EWS上遇到了身份验证问题.
我尝试使用由rackspace提供的云Outlook帐户上的应用程序,一切正常,所以我知道凭据是准确的.
这是代码:
import java.net.URI;
import java.net.URISyntaxException;
import microsoft.exchange.webservices.data.*;
public class TestClass {
public static void main(String[] args) {
TestClass obj = new TestClass();
obj.testMethod();
}
public void testMethod() {
ExchangeService service = new ExchangeService(
ExchangeVersion.Exchange2007_SP1);
ExchangeCredentials credentials = new WebCredentials("username",
"password");
service.setCredentials(credentials);
try {
service.setUrl(new URI("https://domain/EWS/Exchange.asmx"));
} catch (URISyntaxException e) {
e.printStackTrace();