To disable search in one sharepoint Website
SPWeb spWeb = new SPSite("http://krishna/sites/rama").AllWebs["Narayana"];
spWeb.AllowAutomaticASPXPageIndexing = false;
spWeb.ASPXPageIndexMode = WebASPXPageIndexMode.Never;
spWeb.NoCrawl = true;
spWeb.Update();
To disable Search for all the Web sites in the given site collection in Sharepoint.
foreach (SPWeb web in new SPSite("http://krishna/sites/rama").AllWebs)
{
web.AllowAutomaticASPXPageIndexing = false;
web.ASPXPageIndexMode = WebASPXPageIndexMode.Never;
web.NoCrawl = true;
web.Update();
}
This code will not disable the search box, but, gives zero results for any search query.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment