Working With Taxonomy Field in CSOM
How to create taxonomy field with CSOM
If you need to programmatic create a taxonomy field, you need to:
- Know the termstore id and termset id that associated with this column
- Create a taxonomy field with schema include some basic attributes
- Update some essential attributes for the taxonomy field
//Add field as xml with some basic attribute
XElement fieldSchema = new XElement("Field");
fieldSchema.SetAttributeValue("Type", "TaxonomyFieldType");
fieldSchema.SetAttributeValue("DisplayName", "TestField"); list.Fields.AddFieldAsXml(fieldSchema.ToString(), true, AddFieldOptions.DefaultValue); context.ExecuteQuery(); //get taxonomy field
context.Load(list.Fields, fields => fields.IncludeWithDefaultProperties().Where(f => f.Title == "TestField"));
context.ExecuteQuery(); var taxonomyField = list.Fields[] as TaxonomyField; //Update essential attributes for taxonomy field // Specify the Id of termset associated with the column
taxonomyField.TermSetId = new Guid("a518b741-e2eb-429a-8dc7-f737945b25a3");
// Id of the term store
taxonomyField.SspId = new Guid("151320eb-50d2-468d-b42e-1531301953a7"); taxonomyField.Update(); context.ExecuteQuery();
How to update taxonomy field value with CSOM
If you need to programmatic update taxonomy field value, you need to get the term id and label first. This sample shows how to update taxonomy field with multiple values.
ListItem item = list.GetItemById();
TaxonomyFieldValueCollection col = new TaxonomyFieldValueCollection(context, "", taxonomyField);
col.PopulateFromLabelGuidPairs("invrev-mel|44c3035c-b84b-4da3-b7fc-1097ab5e07e2;BEE|c0e6e20a-142f-4f07-ac10-3cf1aa692b13;05 Industry Data and News|b4030964-270b-4f80-bedd-0c2d9d7fae22");
taxonomyField.SetFieldValueByValueCollection(item, col);
Working With Taxonomy Field in CSOM的更多相关文章
- SharePoint 2013 Create taxonomy field
创建taxonomy field之前我们首先来学习一下如果创建termSet,原因是我们所创建的taxonomy field需要关联到termSet. 简单介绍一下Taxonomy Term Stor ...
- Creating fields using CSOM
When creating a field, whether you are using CAML, server-side object mode, or one of the client-s ...
- share point CSOM 客户端模式 创建 list
/// <summary> /// 创建新的列表 list /// </summary> /// <param name="web"></ ...
- 详细分析Orchard的Content、Drivers, Shapes and Placement 类型
本文原文来自:http://skywalkersoftwaredevelopment.net/blog/a-closer-look-at-content-types-drivers-shapes-an ...
- wordpress---wp_query的使用方法
wp_query是一个wordpress用于复杂请求的的一个类,看到query懂开发的人就会反应这个是数据库查询的一个类,这个类可谓是非常有用的,可以帮助我们做很多复杂的查询. wp_query的使用 ...
- SharePoint 2013 Create Folder with conententtype programer
记录一下昨天写的SharePoint tool,需求是这样的: 在SharePoint list subfolder 下创建1000个folder,这些folder指定特殊的contenttype,c ...
- SharePoint 2013 开发——CSOM概要
博客地址:http://blog.csdn.net/FoxDave 本篇对客户端API做一个大致地了解. 看一下各个类别主要API之间的对应关系表. 假设我们对Server API已经有了足够地了 ...
- share point CSOM 客户端模式 创建表 增删改查
需要引用:Microsoft.SharePoint.Client ascx: <h4>CSOM所有表名</h4> <table> <tr> <td ...
- salesforce 零基础学习(六十二)获取sObject中类型为Picklist的field values(含record type)
本篇引用以下三个链接: http://www.tgerm.com/2012/01/recordtype-specific-picklist-values.html?m=1 https://github ...
随机推荐
- iOS响应者链和事件传递机制
原文来自:http://www.cnblogs.com/zhw511006/p/3517248.html 响应者链(Responder Chain) 通常,一个iOS应用中,在一块屏幕上通常有很多的U ...
- hdu 1757 A Simple Math Problem (乘法矩阵)
A Simple Math Problem Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- (转)C#中两个问号和一个问号 ??
小问题难倒很多人.今天发现了这个问题,搜了很长时间才看到记录下. 实例:dt.Columns.Add(firstRow.GetCell(i).StringCellValue ?? string.For ...
- C# 编程指南-事件
来自微软官方的msdn: 首页:https://msdn.microsoft.com/zh-cn/library/ms366768.aspx 1.如何:订阅和取消订阅事件 2.如何:发布符 ...
- VS发布网站详细步骤
1.打开你的VS2012网站项目,右键点击项目>菜单中 重新生成一下网站项目:再次点击右键>发布: 2.弹出网站发布设置面板,点击<新建..>,创建新的发布配置文件: 输入你自 ...
- 网页中的JavaScript
变量的声明和赋值 var count;定义变量 count = 5;赋值 var” - 用于声明变量的关键字 “count” - 变量名 同时声明和赋值变量 var count = 10; 声明多个变 ...
- cinder ha
- C#字段中加入list<类字段> 的两种写法
类1 public class NumCon { public string zsNum { get; set; } } 类2 public class RepeatMess //重复数据响应 { p ...
- iOS 支付宝支付
在开发过程中,经常需要接入第三方支付.下面对支付进行一个概括. 支付宝支付 支付宝SDK下载地址:https://doc.open.alipay.com/doc2/detail?treeId=54&a ...
- 解决AndroidADT自带Eclipse编辑器不能自动代码提示的问题
今天发现,我下载的AndroidADT开发套装中自带的Eclipse没有自动代码提示功能.通过参考http://blog.csdn.net/coolszy/article/details/724195 ...