是否可以仅使用jQuery的AJAX函数调用Exchange Web服务?如果是这样,任何代码示例都可以使用?我目前正在与IIS中的Exchange.asmx相同的目录中托管HTML文件 . 我在该文件中运行此脚本,并得到“方法不允许”响应 . 有线索吗? (用户名,密码,域名在下面的脚本中重命名,原因很明显......)
$.ajax({
url: "Exchange.asmx/FindItem",
data: '{"username":"username", "password":"password", "domain":"domain"}',
type: "POST",
contentType: "application / json; charset = utf-8",
dataType: "json",
success: function (data) {
alert("success " + data);
},
error: function (data) {
alert("error " + data.statusText);
}
});
1 回答
EWS将返回XML,而不是JSON - 快速谷歌给出了这个:http://openlandscape.net/2009/09/25/call-soap-xm-web-services-with-jquery-ajax/不是100%确定它是否在正确的轨道上's right for EWS or not but google on SOAP XML jquery or something and you should be able to figure it out. It looks like it'无论如何 .
还有一个很好的util用于测试EWS SOAP包,它们将对你有很大的帮助:http://soape.codeplex.com/
如果Exchange服务器使用NTLM,则不需要用户名/密码,因为它将对执行调用的用户进行身份验证 .