我正在尝试在 home.domain.com 上使用 Javascript 访问 neighbor.domain.com 的列表数据。两者都是 Sharepoint 2007。
我正在使用 this question's top answer 中的代码.
$(function(){
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>Documents</listName> \
<viewFields> \
<ViewFields> \
<FieldRef Name='Title' /> \
</ViewFields> \
</viewFields> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax({
url: "http://neighbor.domain.com/sites/site1/_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
contentType: "text/xml; charset=\"utf-8\"",
complete: function(xData, status){
$(xData.responseXML).find("z\\:row").each(function(){
var title = $(this).attr("ows_FileLeafRef").split("#")[1];
alert(title);
})
},
error: function(){
alert("error");
}
});
});
这对我不起作用。我收到错误:访问被拒绝。
我添加了 jQuery.support.cors = true
但也没有运气。
我有什么遗漏的吗?是否需要在其他域(neighbor.domain.com)实现某些功能?
我没有服务器计算机的管理访问权限(只有开发人员可以访问 Sharepoint)。我只有 neighbor.domain.com 的读取权限。
更新(2013 年 7 月 10 日):我对 neighbor.domain.com 拥有不止读取权限。我的解决方案涉及在另一个子域上添加一个文件,该文件将根据传递给它的 URL 参数检索列表数据。
最佳答案
尝试我对这个问题的回答。那更容易:)它是 here
关于jquery - 跨子域共享点列表访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9573790/