share point CSOM 客户端模式 创建 list
/// <summary>
/// 创建新的列表 list
/// </summary>
/// <param name="web"></param>
/// <param name="context"></param>
public static void CreateLsit(Web web, ClientContext context)
{
//表名
string tableName = "Form11List"; ListCreationInformation listCreationInfo = new ListCreationInformation();
listCreationInfo.Title = tableName;
listCreationInfo.TemplateType = (int)ListTemplateType.GenericList;
List list_Info = web.Lists.Add(listCreationInfo);
list_Info.Description = "New Description";
// Add fields to the list.
Field field1 = list_Info.Fields.AddFieldAsXml(
@"<Field Type='Choice'
DisplayName='City'
Format='Dropdown'>
<Default>北京市</Default>
<CHOICES>
<CHOICE>上海市</CHOICE>
<CHOICE>深圳市</CHOICE>
</CHOICES>
</Field>",
true, AddFieldOptions.DefaultValue);
Field field2 = list_Info.Fields.AddFieldAsXml(
@"<Field Type='Text'
DisplayName='Name'/>",
true, AddFieldOptions.DefaultValue); Field field3 = list_Info.Fields.AddFieldAsXml(
@"<Field Type='Number'
DisplayName='Age'/>",
true, AddFieldOptions.DefaultValue); Field field4 = list_Info.Fields.AddFieldAsXml(
@"<Field Type='Note'
DisplayName='Desc'/>",
true, AddFieldOptions.DefaultValue); list_Info.Update();
context.ExecuteQuery(); List announcementsList = context.Web.Lists.GetByTitle(tableName);
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem newItem = announcementsList.AddItem(itemCreateInfo);
newItem["Title"] = "My New Item!";
newItem["Name"] = "";
newItem["Age"] = "";
newItem["Desc"] = "";
newItem.Update(); context.ExecuteQuery();
}
Contains CSOM expando fields, which correspond to the fields defined in the parent list. The CSOM expando field name is the name of the field defined in the list and the CSOM expando field value is the field value in the list item. The following table defines the mapping between field types and values.
|
Field Type |
CSOM Expando Field Value Type |
Meaning |
|---|---|---|
|
Integer |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Int32. |
Field allows an integer value. |
|
Text |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
Field allows a limited-length string of text. |
|
Note |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
Field allows larger amounts of text. |
|
DateTime |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime. |
Field allows full date and time values, as well as date-only values. |
|
Counter |
It must be CSOM Int32. |
Counter is a monotonically increasing integer field, and has a unique value in relation to other values that are stored for the field in the list. Counter is used only for the list item identifier field, and not intended for use elsewhere. |
|
Choice |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
Field allows selection from a set of suggested values. A choice field supports a field-level setting which specifies whether free-form values are supported. |
|
Lookup |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Object. |
Field allows a reference to another list item. The field supports specification of a list identifier for a targeted list. An optional site identifier can also be specified, which specifies the site of the list which contains the target of the lookup. |
|
Boolean |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean. |
Field allows a true or false value. |
|
Number |
When its value is undefined it must be CSOM null, otherwise it must be CSOM Double. |
Field allows a positive or negative number. A number field supports a field level setting used to specify the number of decimal places to display. |
|
Currency |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Double. |
Field allows for currency-related data. The Currency field has a CurrencyLocaleId property which takes a locale identifier of the currency to use. |
|
URL |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Object. |
Field allows a URL and optional description of the URL. |
|
Computed |
N/A |
Field renders output based on the value of other columns. |
|
Threading |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
Contains data on the threading of items in a discussion board. |
|
Guid |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM GUID. |
Specifies that the value of the field is a GUID. |
|
MultiChoice |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array. |
Field allows one or more values from a set of specified choices. A MultiChoice field can also support free-form values. |
|
GridChoice |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array. |
Grid choice supports specification of multiple number scales in a list. |
|
Calculated |
N/A |
Field value is calculated based on the value of other columns. |
|
File |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
Specifies a reference to a file that can be used to retrieve the contents of that file. |
|
Attachments |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean. |
Field describes whether one or more files are associated with the item. See Attachments for more information on attachments. true if a list item has attachments, and false if a list item does not have attachments. |
|
User |
When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Object. |
A lookup to a particular user in the User Info list. |
|
Recurrence |
When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean. |
Specifies whether a field contains a recurrence pattern for an item. |
|
CrossProjectLink |
When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean. |
Field allows a link to a Meeting Workspace site. |
|
ModStat |
When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM int32. |
Specifies the current status of a moderation process on the document. |
|
Error |
N/A |
Specifies errors. Value = 24. |
|
ContentTypeId |
When its value is undefined it MUST be CSOM 空引用(无 在 Visual Basic 中), otherwise it MUST be CSOM Object. |
Field contains a content type identifier for an item. ContentTypeId conforms to the structure defined in ContentTypeId. |
|
PageSeparator |
N/A |
Represents a placeholder for a page separator in a survey list. PageSeparator is only intended to be used with a Survey list. |
|
ThreadIndex |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
Contains a compiled index of threads in a discussion board. |
|
WorkflowStatus |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Int32. |
Contains status on a running workflow for a particular item. |
|
AllDayEvent |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean. |
The AllDayEvent field is only used in conjunction with an Events list. true if the item is an all day event (that is, does not occur during a specific set of hours in a day). |
|
WorkflowEventType |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Int32. |
A description of a type of a historical workflow event. See WorkflowEventType Enumeration for more information. |
|
Facilities |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array. |
|
|
FreeBusy |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
|
|
Overbook |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
|
|
Confidential |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean. |
|
|
WhatsNew |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean. |
|
|
DueDate |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime. |
|
|
AllowEditing |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Boolean. |
|
|
SendTo |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array |
|
|
Confirmations |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
|
|
CallTo |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM Array. |
|
|
CallTime |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime. |
|
|
Whereabout |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
|
|
From |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime. |
|
|
Until |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM DateTime. |
|
|
ContactInfo |
When its value is undefined it must be CSOM 空引用(无 在 Visual Basic 中), otherwise it must be CSOM String. |
MSDN :https://msdn.microsoft.com/zh-cn/library/office/microsoft.sharepoint.client.listitem.aspx
share point CSOM 客户端模式 创建 list的更多相关文章
- share point CSOM 客户端模式 创建表 增删改查
需要引用:Microsoft.SharePoint.Client ascx: <h4>CSOM所有表名</h4> <table> <tr> <td ...
- WCF技术剖析之五:利用ASP.NET兼容模式创建支持会话(Session)的WCF服务
原文:WCF技术剖析之五:利用ASP.NET兼容模式创建支持会话(Session)的WCF服务 在<基于IIS的WCF服务寄宿(Hosting)实现揭秘>中,我们谈到在采用基于IIS(或者 ...
- FactoryMethod工厂方法模式(创建型模式)
1.工厂方法模式解决的问题 现在有一个抽象的游戏设施建造系统,负责构建一个现代风格和古典风格的房屋和道路. 前提:抽象变化较慢,实现变化较快(不稳定) 整个抽象的游戏设施建造系统相对变化较慢,本例中只 ...
- Prototype原型模式(创建型模式)
1.原型模式解决的问题 现在有一个抽象的游戏设施建造系统,负责构建一个现代风格和古典风格的房屋和道路. 前提:抽象变化较慢,实现变化较快(不稳定) 整个抽象的游戏设施建造系统相对变化较慢,本例中只有一 ...
- NIO客户端主要创建过程
NIO客户端主要创建过程: 步骤一:打开SocketChannel,绑定客户端本地地址(可选,默认系统会随机分配一个可用的本地地址),示例代码如下: SocketChannel client ...
- Core篇——初探IdentityServer4(客户端模式,密码模式)
Core篇——初探IdentityServer4(客户端模式,密码模式) 目录 1.Oatuth2协议的客户端模式介绍2.IdentityServer4客户端模式实现3.Oatuth2协议的密码模式介 ...
- .Net Core身份认证:IdentityServer4实现OAuth 2.0 客户端模式 - 简书
原文:.Net Core身份认证:IdentityServer4实现OAuth 2.0 客户端模式 - 简书 一.客户端模式介绍 客户端模式(Client Credentials Grant)是指客户 ...
- 微服务(入门学习五):identityServer4+ocelot+consul实现简单客户端模式
简介 主要是采用identity Server4 和ocelot 加上consul 实现简单的客户端模式 开发准备 环境准备 下载并安装Consul具体请参考前几篇的内容 项目介绍 创建ocelot ...
- IdentityServer4实现OAuth2.0四种模式之客户端模式
一,准备内容 IdentityServer4 是Asp.net core的一个中间件,用于添加符合OpenId Connect和OAuth2.0规范的终端到Asp.net Core应用.在这里简单介绍 ...
随机推荐
- python3连接Mongodb
前提条件,安装过Mongondb,并且装一下Robomongo(为了更加直观地看到测试时数据的变化 ) 1.安装PyMySQL pip install pymongo 2.测试 import pymo ...
- mysql出现) Notice: Trying to get property of non-object in E:\p错误的 原因
在mysql中,每个命令之间都要留一点空格 如果是这样, $query = "select * from books where " .$searchtype. "lik ...
- ASP.NET Identity 2集成到MVC5项目--笔记02
ASP.NET Identity 2集成到MVC5项目--笔记01 ASP.NET Identity 2集成到MVC5项目--笔记02 继上一篇,本篇主要是实现邮件.用户名登陆和登陆前邮件认证. 1. ...
- When an HTTP server receives a request for a CGI script
cgicc: Overview of the Common Gateway Interface https://www.gnu.org/software/cgicc/doc/cgi_overview. ...
- SQL中的函数 •Aggregate 函数 •Scalar 函数
合计函数 :Aggregate是针对一系列值的操作,返回一个单一的值 Scalar 函数是针对一个单一的值的操作,返回基于输入值的一个单一值 合计函数: AVG()返回某列的平均值:COUNT()返 ...
- 接口测试工具 — jmeter(关联)
1.正则表达式 1)添加正则表达式提取器 2)提取关联词 3)填写正则表达式 4)使用关联,其他请求使用${sign2}代替变量值 2. 1)添加提取器 2)填写变量值 3)使用关联,其他请求使用${ ...
- SpringMVC 之数据转换和国际化
1. 数据绑定流程 SpringMVC 主框架将 ServletRequest 对象及目标方法的入参实例传递给 WebDataBinderFactory 实例,以创建 DataBinder 实例对象; ...
- PostgreSQL: WITH Queries (Common Table Expressions)
WITH 允许在 SELECT 语句中定义"表"的表达式,这个"表"的表达式称之为"公共表表达式(Common Table Expression)&q ...
- 我的Android进阶之旅------>Android通用流行框架大全
Android通用流行框架大全 缓存 图片加载 图片处理 网络请求 网络解析 数据库 依赖注入 图表 后台处理 事件总线 响应式编程 Log框架 测试框架 调试框架 性能优化 本文转载于lavor的博 ...
- Python高级教程-切片
Python中的切片 取一个list或tuple的部分元素是非常常见的操作.比如,一个list如下: >>> L = ['A','B','C','D'] 对经常取指定索引范围的操作, ...