status Code: 409
status Text :conflict
Solution: Get latest list item instance
Code Ex:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var listName = "MyList"; | |
var idd = "20"; | |
var objCtx = new SP.ClientContext.get_current(); | |
var MyList = objCtx.get_web().get_lists().getByTitle(listName); | |
objCtx.load(MyList); | |
var theList = objCtx.get_web().get_lists().getByTitle(listName); | |
var listItem = theList.getItemById(idd); | |
listItem.set_item("Title", "Update"); | |
listItem.update(); | |
objCtx.load(listItem); | |
objCtx.executeQueryAsync( | |
function () { | |
//File Upload | |
//I have 5 attachments, I am going to upload 5 | |
for (var i = 0; i < 5; i++) { | |
uploadFile(i);//My custom function to upload file....... | |
//Reload Item-Start | |
var objcontext = new SP.ClientContext(); | |
var MyList1 = objcontext.get_web().get_lists().getByTitle(listName); | |
listItem = MyList1.getItemById(idd); | |
objcontext.load(listItem, "Title"); | |
objcontext.executeQueryAsync(function () { | |
console.log("New Item instance Done"); | |
}, function (sender, args) { | |
console.log("New List Item instance Fail" + args.get_message()); | |
}); | |
//Reload Item- End | |
} | |
//File Upload Done | |
}, | |
function (sender, args) { | |
console.log(args.get_message()+ "Error while update"); | |
} | |
); |