我爲一個政府組織工作,我們有一個大型的SharePoint 2007農場。我們使用jQuery和SPServices庫來對各種SharePoint列表執行AJAX調用。
爲了您的具體需要,您可以使用類似下面的代碼示例來執行一系列Web請求。
下面是更新SharePoint列表的API:
http://spservices.codeplex.com/wikipage?title=UpdateListItems&referringTitle=Lists
這裏有一個代碼示例:
PARAMS
batchCmd: "Update",
valuepairs:
[["Title", "New Title Value"],
["Body", "Here is a the new text for the body column."]], ID: 1234,
XML
<Batch OnError='Continue'>
<Method ID='1' Cmd='Update'>
<Field Name='Title'>New Title Value</Field>
<Field Name='Body'>Here is a the new text for the body column.</Field>
<Field Name='ID'>1234</Field>
</Method>
</Batch>
JS
$(divId).html(waitMessage).SPServices({
operation: "UpdateListItems",
listName: testList,
ID: ID,
valuepairs: [["Title", now]],
completefunc: function (xData, Status) {
var out = $().SPServices.SPDebugXMLHttpResult({
node: xData.responseXML,
outputId: divId
});
$(divId).html("").append("<b>This is the output from the UpdateListItems operation:</b>" + out);
$(divId).append("<b>Refresh to see the change in the list above.</b>");
}
});