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

发布于 2024-11-05 16:00:48 字数 223 浏览 2 评论 0原文

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

非常感谢任何帮助!

I have an ID field in one of my lists which may change and needs to be updated in list items in various lists. I need to know if this is possible. I know I could accomplish it using C# and Sharepoint Services, but I have the need to do it through javascript. Basically, I have 5 lists and on changing the value of a client ID in one of those lists and clicking "OK", I need to iterate through the other 4 lists and change that value for any items that may exist in those lists with that ClientID.

Any assistance is greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独守阴晴ぅ圆缺 2024-11-12 16:00:48

我在一家政府组织工作,我们有一个大型 SharePoint 2007 Farm。我们使用 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>");
    }
});

I work for a gov't organization and we have a large-scale SharePoint 2007 Farm. We use jQuery and SPServices libraries to do AJAX calls to various SharePoint Lists.

For your specific need you would do a series of web requests using something like the code example below.

Here's the API for updating a SharePoint List:
http://spservices.codeplex.com/wikipage?title=UpdateListItems&referringTitle=Lists

Here's a code example:

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>");
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文