我想從訪問列表數據neighbor.domain.com使用Javascript on home.domain.com。兩者都是Sharepoint 2007.跨子域Sharepoint列表訪問
我使用的代碼來自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。
UPDATE(2013年7月10日):我比讀訪問權neighbor.domain.com更多。我的解決方案涉及在另一個子域上添加一個文件,該文件將根據傳遞給它的URL參數來檢索列表數據。
你也許得到與NT驗證的雙躍點問題? – Nat 2012-03-05 21:11:12
有什麼方法可以測試嗎?直到今天,我還沒有聽說過雙跳問題。基於[本文](http://weblogs.asp.net/owscott/archive/2008/08/22/iis-windows-authentication-and-the-double-hop-issue.aspx):我知道匿名訪問被禁用,不確定模擬。 – branflake 2012-03-05 21:21:17
您可以通過硬編碼ajax調用的憑據來進行測試。 – Nat 2012-03-05 21:31:34