Posts Tagged ‘ sharepoint ’

‘Data is Null’ Search Error for Indexing Local SharePoint Sites

After months of search indexing working perfectly in SharePoint 2010 on the Local SharePoint Sites, we all of a sudden began to get errors on every single page in our content site collection.  This is the error that we found in the Search Service Application: Crawl Log.

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. )

After some research it was suggested that it could be related to an SPGroup on the site collection that was create programmatically with a null description.  Here is example code of how SPGroups are created and where this issue would occur.

using(SPWeb web = SPContext.Current.Site.RootWeb)
{
//PARAMETERS: Group Name, Group Owner, Default User, Description
web.SiteGroups.Add(“New Group Name”,  SPContext.Current.Web.CurrentUser, SPContext.Current.Web.CurrentUser, null);

web.Update();
}

Obviously our issue did not stem from explicitly passing NULL as the description but our function that handled group creation took the description in as a parameter.  We fixed this function to make sure that it never attempts to create a group with a null description but we still needed to figure out which group or groups were causing the problem.  To handle this, I created a quick Powershell Script that cycles through all of the SPGroups in the root web and corrects any groups that have this issue.  Below is the code for that script:

#PARENT WEB
$parentWeb = “http://rootweburl/”

#GET THE PARENT WEB
$web = Get-SPWeb $parentWeb

if($web) {
foreach($group in $web.SiteGroups){
if($group.Description -eq $null) {
Write-Host $group.Name
$group.Description = $group.Name
$group.Update()
}
}
}

#DISPOSE OF PARENT WEB
$web.Dispose()

After running this script (where we found the 1 group that was the culprit) I was able to run a full index on the Local SharePoint Sites and everything was resolved.

Advertisements

SharePoint 2010 Search Service: Local SharePoint Sites Cannot Be Crawled Error

I recently migrated to a new SharePoint 2010 system where I split out our old application server into a separate SharePoint 2010 Application Server and SharePoint 2010 Web Front End (WFE).  I initially setup the web server to redirect all traffic to fully qualified domain name such as http://sharepoint.test.com.  At this point the SharePoint 2010 Search Service worked as expected when crawling the local SharePoint site and user profiles via the following links:

After I launched on the new system, the decision was made to switch to having the web server redirect everything to simply http://sharepoint.  The reason for this was to have our SharePoint site be in the Intranet Zone for Internet Explorer and Chrome so that it would automatically logon users via their Active Directory credentials.  Everything went fine until I tried to run a search crawl and got the following error:

The start address http://sharepoint (and sps3://sharepoint ) cannot be crawled.

Context: Application ‘Search_Service_Application’, Catalog ‘Portal_Content’

Details:
This item could not be crawled because the repository did not respond within the specified timeout period. Try to crawl the repository at a later time, or increase the timeout value on the Proxy and Timeout page in search administration. You might also want to crawl this repository during off-peak usage times. (0x80040d7b)

I investigated a lot of different fixes but in the end the issue was with the proxy server that was set on the web and application servers.  The servers needed a proxy in order to have web access for Windows Updates, etc but the issue turned out to be that the proxy server was not allowing resolution of the short url of http://sharepoint.  The resolution was to add the following rules to the proxy bypass list and reboot the servers.  To do this run command prompt as an admin and use the following command:

netsh winhttp set proxy xxx.xxx.xxx.xxx:portnumber bypass-list=”<local>,sharepoint”

Here is some more information on the winhttp set proxy command.

Advertisements