在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

posted @ 2010-11-22 10:20  Sunmoonfire  阅读(376)  评论(0编辑  收藏  举报