如何在sharepoint列表中添加多个查找值。在sharepoint中添加项目时
我的任务有多个relateddocId,例如RelatedDoc=“3,5,2,6”,现在我需要将multiplevalue添加到任务列表中名为related Document的sharepoint查找字段中。如何添加这个 参考见下面我的代码如何在sharepoint列表中添加多个查找值。在sharepoint中添加项目时,sharepoint,lookup,Sharepoint,Lookup,我的任务有多个relateddocId,例如RelatedDoc=“3,5,2,6”,现在我需要将multiplevalue添加到任务列表中名为related Document的sharepoint查找字段中。如何添加这个 参考见下面我的代码 private static void CreateItem(SPWeb web, SPList TaskList, string FolderURL, string ItemName, string RelatedDoc) {
private static void CreateItem(SPWeb web, SPList TaskList, string FolderURL, string ItemName, string RelatedDoc)
{
var ParentURL = string.Empty;
if (!TaskList.ParentWebUrl.Equals("/"))
{
ParentURL = TaskList.ParentWebUrl;
}
SPListItem _taskList = TaskList.AddItem(ParentURL + FolderURL, SPFileSystemObjectType.File, null);
_taskList["Title"] = ItemName;
string DocName = "4,6,3,6";//Document ref id.
SPFieldLookupValue lookupvalue = new SPFieldLookupValue();
if (DocName != "")
lookupvalue = new SPFieldLookupValue(RelatedDoc, DocName);
_taskList["EYRelatedSharedDocument"] = lookupvalue;
_taskList.Update();
}
SPFieldLookupValueCollection documents = new SPFieldLookupValueCollection();
foreach ( ... )
{
documents.Add(new SPFieldLookupValue(documentId, documentTitle));
}
_taskList["EYRelatedSharedDocument"] = documents;
_taskList.Update();