How to set the Search Centre URL in SharePoint 2013 Using Javascript?

In this blog, I will give you the piece of code to set the Search Center URL in SharePoint 2013 using JavaScript. Below is the piece of code to achieve the same.

var context= new SP.ClientContext.get_current();
var web = context.get_site().get_rootWeb();
var properties = web.get_allProperties();

properties .set_item(“SRCH_ENH_FTR_URL”,”/sites/search/mypages”);
web.update();
context.load(web);

context.executeQueryAsync(function () {
alert(“Successful”));
},
function() {
alert(“failed”);
});

Please check my other set of interesting articles on

Current List Item in SharePoint 2013/Office 365 using JavaScript

   Get-the-list-of-user-profiles-in-office-365

How to set the Client People Picker value in SharePoint 2013.

Retrieving Query Results by Date Range in SharePoint Site 2013 Using REST SEARCH API

Share you SharePoint Site to External User in SharePoint Online /Office 365

Differences between Search features in SharePoint 2010 vs 2013/Office 365

Happy SharePointing Folks!! Hope it helps you guys!!

Leave a Reply

Your email address will not be published.