I'm trying to make a JSOM utility that will allow me to alter the properties of pre-existing document libraries. So far I have successfully managed to update the list 'Title' and 'Description' properties.
The bit I am stuck on is how can I update the URL for the list to a value of my choosing?
I have had a look already at this MSDN advice on the List Object. There are no pre-existing methods that I can use to update the URL.
Is there a way of doing this in JSOM in SharePoint or have I hit a dead end? Any help would be very much appreciated.
My code so far is as follows:
// Get the current context
var context = new SP.ClientContext.get_current();
// Get the current site (SPWeb)
var web = context.get_web();
// Get the library
var list = web.get_lists().getByTitle(ExDocLibName);
//Update some properties of the library
list.set_description('Updated Library description')
list.set_title(NewDocLibName)
list.update();
context.load(list)
// Create callback handlers
var success = Function.createDelegate(this, this.onSuccess);
var failure = Function.createDelegate(this, this.onFailure);
// Execute an async query
context.executeQueryAsync(success,failure);
}
// Async query succeeded.
function onSuccess(sender, args) {
alert('library details have been updated');
// Refresh the page.
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
// Async query failed.
function onFailure(sender, args) {
alert(args.get_message());
}

0 commentaires:
Enregistrer un commentaire