c#客户端对象模型代码以更新"multilookup". sharepoint 2013中的列 [英] c# client object model code to update "multilookup" column in sharepoint 2013

查看:89
本文介绍了c#客户端对象模型代码以更新"multilookup". sharepoint 2013中的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试使用c#客户端对象模型在SharePoint 2013中设置和更新多查找列字段值.任何示例代码都会有所帮助!

Hi everyone, I'm trying to set and update Multi lookup column field value in SharePoint 2013 using c# client object model. Any sample code will be helpful!

谢谢!

推荐答案

这是示例代码供您参考:

ClientContext ctx = new ClientContext(weburl); ctx.Credentials = new SharePointOnlineCredentials(userName, passWord); List list = ctx.Web.Lists.GetByTitle("ListTitle"); ListItem currentItem = list.GetItemById(1); FieldLookupValue[] lookupFieldValCollection = new FieldLookupValue[3];

FieldLookupValue lookupFieldA = new FieldLookupValue(); lookupFieldA.LookupId = 2; lookupFieldValCollection.SetValue(lookupFieldA,0); FieldLookupValue lookupFieldB =新的FieldLookupValue(); lookupFieldB.LookupId = 4; lookupFieldValCollection.SetValue(lookupFieldB,1); FieldLookupValue lookupFieldC =新的FieldLookupValue(); lookupFieldC.LookupId = 6; lookupFieldValCollection.SetValue(lookupFieldC,2); currentItem ["MultiLookupValCol"] = lookupFieldValCollection; currentItem.Update(); ctx.ExecuteQuery();

FieldLookupValue lookupFieldA = new FieldLookupValue(); lookupFieldA.LookupId = 2; lookupFieldValCollection.SetValue(lookupFieldA, 0); FieldLookupValue lookupFieldB = new FieldLookupValue(); lookupFieldB.LookupId = 4; lookupFieldValCollection.SetValue(lookupFieldB, 1); FieldLookupValue lookupFieldC = new FieldLookupValue(); lookupFieldC.LookupId = 6; lookupFieldValCollection.SetValue(lookupFieldC, 2); currentItem["MultiLookupValCol"] = lookupFieldValCollection; currentItem.Update(); ctx.ExecuteQuery();

https://piyushksingh.com/2014/01/19/update-a-lookupmulti-column-value-in-sharepoint-using-client-object-model-c/

您可以发布问题(如果有的话).

Lee


这篇关于c#客户端对象模型代码以更新"multilookup". sharepoint 2013中的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆