找出executeQueryAsync项目创建失败的项目ID

时间:2017-01-02 05:35:12

标签: javascript sharepoint-2013 csom client-object-model sharepoint-object-model

如何找到executeQueryAsync添加项目方法失败的项目?

这是我的代码:

var itemArray = [];
var siteUrl = "http://MySite/MM/cm";
var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('xy');

var itemCreateInfo = new SP.ListItemCreationInformation();
oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('FullName', "ali");
oListItem.set_item('CellPhone', "555-666");

oListItem.update();
itemArray[i] = oListItem;
clientContext.load(itemArray[i]);

clientContext.executeQueryAsync(onQuerySucceeded, onQueryFailed);

function onQuerySucceeded() {
    console.log("item created in : ", oListItem.get_id());
}

function onQueryFailed(sender, args) {
    console.log('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

我不知道在我的查询失败的项目创建中哪些项目是重复的!如果我能找到它,那么我可以更新它并继续其他人!

0 个答案:

没有答案