Monday, April 2, 2012

Troubleshoot Sharepoint Crawler with Fiddler

This Blog is simple but extremely useful (Thanks Matthew MCDermott):

http://www.ableblue.com/blog/archive/2012/01/04/troubleshooting-sharepoint-search-crawl

Find SPLists without Default View

One issues why sometimes the search crawler in SharePoint takes too long, is because of the lack of Default View on the lists form the Site. See the C# Code and explanation at
http://blogs.technet.com/b/victorbutuza/archive/2010/01/15/crawl-taking-indefinitely-to-complete.aspx
This is the power-shell version of the c# code shown on the mentioned site.

 
if(-not(
Get-PSSnapin | Where { $_.Name -eq "Microsoft.SharePoint.PowerShell"})
) {
Add-PSSnapin Microsoft.SharePoint.PowerShell;
}
clear
$spwa = Get-SPWebApplication -Identity "http://myWebAppURL"
foreach ($osite in $spwa.Sites)
{
      foreach ($oweb in $osite.AllWebs)
      {
           write-host $oweb.Url
           write-host "========================================================="
           foreach ($olist in $oweb.Lists)
        {
            if ($olist.Hidden -eq $false)
            {
                  try
                {
                  write-host "Title: "  $olist.Title;
                    if ($olist.DefaultView -eq $null)
                    {
                                   write-host "ERROR: No default list view found " -ForegroundColor Red
                             }
                    else
                    { 
                        #remove this if you have lots of lists
                        write-host "DefaultViewURL: " $olist.DefaultViewUrl
                        write-host "DefaultViewTitle: " $olist.DefaultView.Title
                    }
                }
                catch
                {
                   write-host "ERROR"

                }
            }
            }
           write-host "========================================================="
        $oweb.Dispose();
      }
      $osite.Dispose();
}