2011-05-09 59 views
1

我在其中一个列表中有一个ID字段,它可能会更改并需要在各种列表中的列表项中进行更新。我需要知道这是否可能。我知道我可以使用C#和Sharepoint Services完成它,但我需要通过javascript来完成。基本上,我有5个列表,并在其中一个列表中更改客户端ID的值,然后单击“确定”,我需要遍历其他4个列表并更改该列表中可能存在的任何项目的值客户端ID。以编程方式更改Sharepoint 2007列表的值

任何援助非常感谢!

回答

1

我为一个政府组织工作,我们有一个大型的SharePoint 2007农场。我们使用jQuerySPServices库来对各种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>"); 
    } 
}); 
相关问题