我正在尝试使用 WebServices 将共享点列表的所有列表项放入 Windows 7 小工具中,但我不确定如何做到这一点,
我在谷歌上找到了这段代码,没有任何解释,所以我不知道如何使用这段代码获取列表数据,然后显示在 Windows 小工具中。
任何人都可以指导我正确的方向吗?
小工具.xml是
<?xml version="1.0" encoding="utf-8" ?>
<gadget>
<name>HelloGadget</name>
<version>1.0.0.0</version>
<description>Hello World Gadget.</description>
<hosts>
<host name="sidebar">
<base type="HTML" apiVersion="1.0.0" src="first.html" />
<permissions>Full</permissions>
<platform minPlatformVersion="1.0" />
</host>
</hosts>
</gadget>
first.html是
<html>
<script>
//----------------- resizes the gadget display surface
function DoInit() {
document.body.style.width = 90;
document.body.style.height= 55;
document.body.style.margin=0;
}
$(document).ready(function()
{
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Body>
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>
<listName>ListName</listName>
<viewFields>
<ViewFields>
<FieldRef Name='Title' />
</ViewFields>
</viewFields>
</GetListItems>
</soapenv:Body>
</soapenv:Envelope>";
$.ajax({
url: "http://my_site/_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset="utf-8""
});
});
function processResult(xData, status) {
$(xData.responseXML).find("z\:row").each(function() {
alert($(this).attr("ows_Title"));
});
}
</script>
<body onload="DoInit();">
<table border="5"><tr><td><center><i>Hello World!</i></center></td></tr></table>
<div id = "clickit"> <button type="button" onclick="" >Click Me!</button> </div>
</body>
</html>
干杯