首页 > 其他 > 详细

SharePoint 客户端对象模型 多选查阅项赋值

时间:2018-03-13 19:00:36      阅读:271      评论:0      收藏:0      [点我收藏+]
var clientContext = new SP.ClientContext.get_current(); //if the page and the list are in same site.If list is in different site then use relative url instead of get_current
var oList = clientContext.get_web().get_lists().getByTitle(‘Contacts‘);
var itemCreateInfo = new SP.ListItemCreationInformation();
var oListItem = oList.addItem(itemCreateInfo);

var contactTypes = null;

$.each(contact.contactTypes, function (index, contactType) {
    if (index != 0)
        contactTypes += ‘;#‘ + contactType.id + ‘;#‘ + contactType.title;
    else
        contactTypes =  contactType.id + ‘;#‘ + contactType.title;
});

// other set_item statements omitted for brevity
oListItem.set_item(‘ContactType‘, contactTypes);

oListItem.update();

clientContext.executeQueryAsync(
    // success return
    function () {
        var success = true;
    },
    // failure return
    function (sender, args) {
        window.alert(‘Request to create contact failed. ‘ + args.get_message() +
                ‘\n‘ + args.get_stackTrace());
    })

SharePoint 客户端对象模型 多选查阅项赋值

原文:https://www.cnblogs.com/tengfei8/p/8560408.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!