Update/Edit List title using Javascript Sharepoint.
var oList="";
var Listname="Document Sharing";
var NewTitle="Sharing Documents";
function updateList() {
var clientContext = new SP.ClientContext.get_current();
var oWebsite = clientContext.get_web();
oList = clientContext.get_web().get_lists().getByTitle(Listname);
this.oList.set_title(NewTitle);
oList.update();
clientContext.load(oList);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
var result ="List title updated to"+ oList.get_title() + '.';
alert(result);
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
updateList("Test");
No comments:
Post a Comment