Freigeben über


Setting Description to null when creating custom SP Groups via code can cause search crawler to fail

Body:

Recently was pulled into troubleshooting a search issue at a customer which prompted me to write this post. Basically the issue was there were excessive number of errors in crawl log. All error items in crawl log pointed to pretty much the same error.

Crawl fails with an error The SharePoint item being crawled returned an error when requesting data from the web service. ( Error from SharePoint site: Data is Null. This method or property cannot be called on Null values. )

See the screen shot below that shows errors in crawl log.

crawlerror

It turns out the cause of this Issue is because there were custom SharePoint groups created via code at the time Site was provisioned via a Provisioning engine with description property set to null.

Here is a simple PowerShell script to check if you have Custom SharePoint Groups with Description set to null.

Add-PSSnapin Microsoft.SharePoint.PowerShell –ea SilentlyContinue

Function ReportSPGroupDescriptionIsNull($url)
{
    $site = Get-SPSite($url)
    ForEach($web in $site.AllWebs)
    {
        Write-Host -ForeGroundColor white -BackGroundColor Blue "Checking site $($web.Title)"
        ForEach($group in $web.Groups)
        {
            if($group.Description -eq $null)
            {
                Write-Host "Description is null for $($group.Name) SharePoint Group"
            }
        }
    }
}

ReportSPGroupDescriptionIsNull({replace with SC url})

So if you run into this issue check your code and see if you are setting the description to a string value when creating custom SharePoint groups.

I also came across this support article that describes this issue https://support.microsoft.com/kb/2323206

Cheers,

</Ram>

Published: 5/8/2012 10:36 AM

Attachments: https://www.spmcm.me/Blog/Lists/Posts/Attachments/51/crawlerror_2_57B0BF11.png
https://www.spmcm.me/Blog/Lists/Posts/Attachments/51/crawlerror_thumb_059E11CA.png