Hello All,
Below code will help you to create an item inside the Folder.
Here is the code:
var clientContext = SP.ClientContext.get_current();
var list = clientContext.get_web().get_lists().getByTitle('Master');
var itemCreateInfo = new SP.ListItemCreationInformation();
itemCreateInfo.set_folderUrl('/Lists/Master/FolderName');
var listItem = list.addItem(itemCreateInfo);
listItem.set_item('Title', 'Hello!');
listItem.update();
clientContext.load(listItem);
clientContext.executeQueryAsync(function (sender, arges) {
alert('Added');
}, function (sender, arges) {
alert(arges.get_message());
});
Hope this helps!!!
No comments:
Post a Comment