簡體   English   中英

SharePoint 2010 客戶端 Object Model + 使用 Z492703B694414 設置多重查找字段的值

[英]SharePoint 2010 Client Object Model + set the value of a multiple lookup field with Javascript

我正在嘗試使用 SharePoint 2010 客戶端 Object Model25492712B6AAAF7D1 更新列表項我要更新的項目有一個多值查找字段。 我可以成功設置這個字段,但只有一個值。 有誰知道如何用多個值設置它?

var _newLookupField = new SP.FieldLookupValue();
    _newLookupField.set_lookupId(itemArray.toString()); //this works if array is only 1 item        

    currentItem.set_item('Lookup_x0020_Field', _newLookupField);
var lookupsIds = [1,2,4];
var lookups = [];
for (var ii in lookupsIds) {
    var lookupValue = new SP.FieldLookupValue();
    lookupValue.set_lookupId(lookupsIds[ii]);
    lookups.push(lookupValue);
}
currentItem.set_item('Lookup_x0020_Field', lookups);
currentItem.update();

我創建了一篇博文,清楚地解釋了如何添加包含帶有查找字段的元數據的列表項。

http://vangalvenkat.blogspot.com/2011/10/adding-new-document-item-whose-metadata.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM