【问题标题】:SharePoint 2010 Client Object Model + set the value of a multiple lookup field with JavascriptSharePoint 2010 客户端对象模型 + 使用 Javascript 设置多个查找字段的值
【发布时间】:2011-10-25 23:28:39
【问题描述】:

我正在尝试使用 SharePoint 2010 客户端对象模型和 Javascript 更新列表项。我要更新的项目有一个多值查找字段。我可以成功设置这个字段,但只有一个值。有谁知道如何设置多个值?

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);

【问题讨论】:

    标签: javascript sharepoint sharepoint-clientobject


    【解决方案1】:

    我创建了一篇博文,清楚地解释了如何添加包含带有查找字段的元数据的列表项。

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

    【讨论】:

      【解决方案2】:
      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();
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-04
        • 2011-02-10
        • 1970-01-01
        • 2013-03-22
        相关资源
        最近更新 更多