Javascript 以编程方式更改Sharepoint 2007列表的值

Javascript 以编程方式更改Sharepoint 2007列表的值,javascript,jquery,list,sharepoint-2007,Javascript,Jquery,List,Sharepoint 2007,我的一个列表中有一个ID字段,该字段可能会更改,需要在各种列表的列表项中更新。我想知道这是否可行。我知道我可以使用C#和Sharepoint Services来完成它,但我需要通过javascript来完成。基本上,我有5个列表,当更改其中一个列表中客户端ID的值并单击“确定”时,我需要迭代其他4个列表,并更改这些列表中可能存在的具有该ClientID的任何项目的值 非常感谢您的帮助 我在一家政府机构工作,我们有一个大型SharePoint 2007农场。我们使用和库对各种SharePoint列

我的一个列表中有一个ID字段,该字段可能会更改,需要在各种列表的列表项中更新。我想知道这是否可行。我知道我可以使用C#和Sharepoint Services来完成它,但我需要通过javascript来完成。基本上,我有5个列表,当更改其中一个列表中客户端ID的值并单击“确定”时,我需要迭代其他4个列表,并更改这些列表中可能存在的具有该ClientID的任何项目的值


非常感谢您的帮助

我在一家政府机构工作,我们有一个大型SharePoint 2007农场。我们使用和库对各种SharePoint列表进行AJAX调用

对于您的特定需求,您可以使用下面的代码示例执行一系列web请求

以下是更新SharePoint列表的API:

下面是一个代码示例:

参数

batchCmd: "Update",
valuepairs: 
    [["Title", "New Title Value"], 
    ["Body", "Here is a the new text for the body column."]], ID: 1234,
<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>
$(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>");
    }
});
XML

batchCmd: "Update",
valuepairs: 
    [["Title", "New Title Value"], 
    ["Body", "Here is a the new text for the body column."]], ID: 1234,
<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>
$(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>");
    }
});

新标题值
下面是正文栏的新文本。
1234
JS

batchCmd: "Update",
valuepairs: 
    [["Title", "New Title Value"], 
    ["Body", "Here is a the new text for the body column."]], ID: 1234,
<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>
$(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>");
    }
});
$(divId).html(waitMessage.SPServices({
操作:“UpdateListItems”,
listName:testList,
ID:ID,
valuepairs:[[“标题”,现在]],
completefunc:函数(扩展数据、状态){
var out=$().SPServices.SPDebugXMLHttpResult({
节点:xData.responseXML,
outputId:divId
});
$(divId.html(“”).append(“这是UpdateListItems操作的输出:“+out”);
$(divId).append(“刷新以查看上面列表中的更改”);
}
});

我在一家政府机构工作,我们有一个大型SharePoint 2007农场。我们使用和库对各种SharePoint列表进行AJAX调用

对于您的特定需求,您可以使用下面的代码示例执行一系列web请求

以下是更新SharePoint列表的API:

下面是一个代码示例:

参数

batchCmd: "Update",
valuepairs: 
    [["Title", "New Title Value"], 
    ["Body", "Here is a the new text for the body column."]], ID: 1234,
<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>
$(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>");
    }
});
XML

batchCmd: "Update",
valuepairs: 
    [["Title", "New Title Value"], 
    ["Body", "Here is a the new text for the body column."]], ID: 1234,
<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>
$(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>");
    }
});

新标题值
下面是正文栏的新文本。
1234
JS

batchCmd: "Update",
valuepairs: 
    [["Title", "New Title Value"], 
    ["Body", "Here is a the new text for the body column."]], ID: 1234,
<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>
$(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>");
    }
});
$(divId).html(waitMessage.SPServices({
操作:“UpdateListItems”,
listName:testList,
ID:ID,
valuepairs:[[“标题”,现在]],
completefunc:函数(扩展数据、状态){
var out=$().SPServices.SPDebugXMLHttpResult({
节点:xData.responseXML,
outputId:divId
});
$(divId.html(“”).append(“这是UpdateListItems操作的输出:“+out”);
$(divId).append(“刷新以查看上面列表中的更改”);
}
});