Set Web Title in SharePoint using JSOM

The example in this topic show how to use JSOM to Set Web Title in SharePoint

  • function SetWebTitle() {
  •     // You can optionally specify the Site URL here to get the context
  •     // If you don't specify the URL, the method will get the context of the current site
  •     // var clientContext = new SP.ClientContext("http://MyServer/sites/MySiteCollection");
  •     var clientContext = new SP.ClientContext();
  •  
  •     var oWeb = clientContext.get_web();
  •  
  •     oWeb.set_title("New Title");
  •     oWeb.update();
  •  
  •     clientContext.executeQueryAsync(Function.createDelegate(this, this.onsuccess), Function.createDelegate(this, this.onfailed));
  • }
  •   
  • function onsuccess() {
  •     console.log("success");
  • }
  •  
  • function onfailed(sender, args) {
  •     console.log('Creation Failed' + args.get_message() + '\n' + args.get_stackTrace());
  • }

Thank you for reading this article. This code was tested in SharePoint 2013

We value your feedback:

Page URL:

Name:

 

Email:

 
 

Feedback:

 

© 2019 Code SharePoint