在SharePoint 2010中通过客户端对象模型获取多选列中的值
一小段代码,用于解释如何用客户端对象模型同多选列中添加并获取值。
ListItemCollection listItems = list.GetItems(camlQuery);
//Add values -
listItems[0]["MultiChoiceField"] = newstring[] {“Choice 1″,”Choice 4″ };
//Retrieve -
if (listItems[0]["testmultichoice"] != null)
{
string[] values = listItems[0]["testmultichoice"] as string[];
if (values != null)
{
var result = from c in values where c.Contains(searchChoice) select c;
if (result != null)
choices = result.ToList();
}
}
return choices;
参考资料
Get values from multichoice column clinet object model sharepoint 2010
浙公网安备 33010602011771号