Sometimes the search services gets stuck, following an index reset or a problem with the search component.
When Search service application shows crawl status as “Paused by system” or “External Request”, it can be fixed below:
Display search component status:
$ssa = Get-SPEnterpriseSearchServiceApplication
get-spenterprisesearchstatus -SearchApplication $ssa -Detailed -Text
Resume search component:
(Optional) If not running SharePoint Management:
Add-PSSnappin "Microsoft.SharePoint.PowerShell"
Then:
$ssa = Get-SPEnterpriseSearchServiceApplication
Resume-SPEnterpriseSearchServiceApplication $ssa
Force a index reset (if stuck):
Make sure to reset the Search Host Controller service and timer service before running theses commands.
(Optional) If not running SharePoint Management:
Add-PSSnappin "Microsoft.SharePoint.PowerShell"
Then:
$ssa = Get-SPEnterpriseSearchServiceApplication
$disableAlerts = $true
$ignoreUnreachableServer = $true
$ssa.reset($disableAlerts, $ignoreUnreachableServer)
When you create a new team site on SharePoint 2013 and SharePoint Online, you are presented with a default "welcome" webpart:
In order to remove this webpart, you may use the client context with the following code:
Using SharePoint Dll:
var web = clientContext.Web;
clientContext.Load(web);
var web = clientContext.Web;
var file = web.GetFileByServerRelativeUrl(web.ServerRelativeUrl + "/SitePages/Home.aspx");
var wpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
web.Context.Load(wpm.WebParts, wps => wps.Include(wp => wp.WebPart.Title));
web.Context.ExecuteQueryRetry();
for(var i=0;i<wpm.WebParts.Count;i++)
if (wpm.WebParts[i].WebPart.Title.Equals("Get started with your site"))
wpm.WebParts[i].DeleteWebPart();
web.Context.ExecuteQueryRetry();
var web = clientContext.Web;
clientContext.Load(web);
web.Context.ExecuteQuery();
web.DeleteWebPart(web.ServerRelativeUrl + "/SitePages/Home.aspx", "Get started with your site");
web.Context.ExecuteQuery();
In order to change the default homepage of a team site, here is the code:
var web = clientContext.Web;
var rootFolder = web.RootFolder;
clientContext.Load(web);
clientContext.Load(rootFolder);
rootFolder.WelcomePage = "/SitePages/MyHomePage.aspx";
rootFolder.Update();
clientContext.ExecuteQuery();