SharePoint 客戶端對象模型 多選查閱項賦值
阿新 • • 發佈:2018-03-13
stat same AD 模型 .exe execute site code reat
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 客戶端對象模型 多選查閱項賦值