zoukankan      html  css  js  c++  java
  • sharepoint lookup字段的读取与赋值

    1.读取

    var columnFieldValue = oListItem.get_item("columnName");
    var lookupValue = columnFieldValue.get_lookupValue();
    var lookupId = columnFieldValue.get_lookupId();

    2.赋值(单个)

    var lookupValue = new SP.FieldLookupValue();
    lookupValue.set_lookupId($("select[title='车辆资源(Resources) selected values'] option")[0].value);
    listItem.set_item('lookupColumn',lookupValue);

     3.赋值(多个)

    //Jsom
    var lookupList=[];
    var oContext=SP.ClientContext.get_current();                    
    var oWeb=oContext.get_web();
    var oList=oWeb.get_lists().getByTitle("Group Calendar");
    var olistItem=oList.getItemById(2164);
    var lookupVal1 = new SP.FieldLookupValue();
    lookupVal1.set_lookupId(36);
    var lookupVal2 = new SP.FieldLookupValue();
    lookupVal2.set_lookupId(73);
    lookupList.push(lookupVal1);
    lookupList.push(lookupVal2);
    console.log();
    olistItem.set_item('Facilities',lookupList);
    olistItem.update();
    oContext.executeQueryAsync(function(){console.log("success");},function(){console.log("fail");});
    //CSOM
    List<FieldLookupValue> lookupList = new List<FieldLookupValue>();
    
    FieldLookupValue LookupVal1 = new FieldLookupValue();
    LookupVal1.LookupId = 36;
    FieldLookupValue LookupVal12= new FieldLookupValue();
    LookupVal2.LookupId = 73;
    lookupList .Add(LookupVal1);
    lookupList .Add(LookupVal2);
    
    listItem["Facilities"] = lookupList ;
    
    listItem.update();
  • 相关阅读:
    spring注解方式AOP
    struts2 值栈的理解
    JAVA自定义注解
    JS学习随笔。
    使用Jsoup解析html网页
    Struts迭代器(iterator)遍历List常用的4种例子
    Maven 结合 Spring profile对不同的部署环境打包部署
    打印插件LODOP使用介绍
    Linux下查看CPU信息、机器型号等硬件信息
    验证码的生成和验证
  • 原文地址:https://www.cnblogs.com/learning-life/p/10406606.html
Copyright © 2011-2022 走看看