使用 JavaScript 从 CSOM 添加、更新和查询 SharePoint 列表项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14514795/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Add, update and query SharePoint list items from CSOM using javascript
提问by pbenemy
Using javascript and SharePoint's CSOM, can someone provide an example for the follow scenario:
使用 javascript 和 SharePoint 的 CSOM,有人可以为以下场景提供示例:
Get field value from the selected items in a list (ListA).
从列表 (ListA) 中的选定项目中获取字段值。
Then for each item selected, take a fields value and use it to query a different list (ListB).
然后对于每个选定的项目,取一个字段值并使用它来查询不同的列表 (ListB)。
If the query returns 0 rows, create item in ListB and update selected item in ListA.
如果查询返回 0 行,则在 ListB 中创建项目并更新 ListA 中的选定项目。
Else if the query returns 1 row, update selected item in ListA.
否则,如果查询返回 1 行,则更新 ListA 中的选定项。
回答by Ryan
This will get you started.
这会让你开始。
MSDN - How to: Complete basic operations using JavaScript library code in SharePoint 2013
MSDN - 如何:在 SharePoint 2013 中使用 JavaScript 库代码完成基本操作
It gives examples of how to
它举例说明了如何
- Query lists and get value
- Add/update and delete records
- and many others common operations
- 查询列表并获取值
- 添加/更新和删除记录
- 以及许多其他常见操作
So, most of what you need to complete your scenario.
因此,完成您的场景所需的大部分内容。