码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-03-13 19:08:18      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:share   create   mes   sts   type   poi   point   nts   index   

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 客户端对象模型 多选查阅项赋值

标签:share   create   mes   sts   type   poi   point   nts   index   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!