Tuesday, April 12, 2016

SharePoint 2013: searchbox on lists/libraries shows no items - standard search works fine...

Recently experienced and solved the following problem:

Search-boxes on lists and document libraries did not show any results even thought standard basic search in osssearchresults.aspx and custom search web parts and web search results worked perfect. My crawler worked fine and I did not find any issues with search service anywwere.

InplaceSearchQuery on document library:

 Default search result page:



Tried every suggestion I could find related to the same problem - no luck. I also checked queries with ULS viewer - nothing suspicious there either.

So, what´s the difference between the basic search result function and InplaceSearchQuery? Apparently this has to do with a server mapping I´ve used on this Site Collections. The InplaceSearchQuery function looks for items in the index based on the wrong URL (my user-friendly URL due to the server mapping). Basic search apparently works differently...

Details:

I have two web applications setup for my solution - actually one default web application (for crawler) and this is extended to another web apps with claims based. The portal for crawling is the default zone portal - and the user-friendly portal is in a custom zone. The crawler does NOT support claims so it has to have NTLM - also imporant: create crawler NTLM portal FIRST in default zone - then extend to your user-friendly portal. I also had a server mapping defined in order to map crawler URL to user-friendly URL for the users in the search results (this is where the culpit is...!) - I thought this was necessary and it looked alright since basic search etc worked fine.

Server mapping:  <crawler-web apps>:<port>    =     <user-friendly web apps>

This server mapping turned out to be the problem, and it was not necessary either because the URL´s in the user-portal showed up correctly without the mapping (I suspect this works because my crawler portal is defined in the default zone).

When I deleted the server mapping, performed a full crawl and tested search again in my document library, things looked good:




Friday, March 4, 2016

SharePoint 2013 Search: crawler worked fine - then stuck on FULL CRAWL

SP2013 Enterprise Search Crawler has worked fine for months but a couple of days ago it was stuck on a FULL CRAWL and could not find any content - no change to the configuration.

No errors in crawl log. No problems recorded with the SQL servers (no failover etc).

ULS was full of "lost connection - reconnecting" on CSSFeeder for Crawler...

CPU (one core) was 100% busy during crawling/slow respons.

Tried following and testet Crawl after each task:

1. Reset Search Index
2. Restart in Windows services: SharePoint Server Search 15
3. Recycle IIS App Pool for portal
4. Restart IIS web site for portal
5. Stop and start SharePoint Service in Central Admin: "Search Host Controller Service"

No luck.

The following did the trick:

6. Reset Search Index again
7. Reduced server load for Search Service (from default Maximum) to (use SharePoint Management Shell as Administrator):

  • Set-SPEnterpriseSearchService -PerformanceLevel PartlyReduced
8. Restart Windows service: SharePoint Server Search 15
9. Started FULL CRAWL - success...



Tuesday, April 24, 2012

SharePoint 2010 - error in DIP when opening Office 2010-documents

Scenario: SharePoint 2010 portal with subsites created from a customized Site Template - a very common situation I guess. An error shows in Office 2010 programs on DIP (document information panel)...

When opening Office-documents from a SharePoint 2010 portal I received the following error when clicking on Edit Properties:

"The Document Informatin Panel was unable to load. The document will continue to load. For more information, contact your system administrator."
"The form cannot be opened. To fix this problem, contact the form designer. Form template: http://your-portal-name/your-site-name/../proppanel.xsn. The XML Schema for the form template has an invalid value for the following attribute: Location." 


Click OK and try to use default proppanl.xsn (click OK i next dialog) but no DIP shows in header - only this:



This is appearently a bug discovered by Microsoft China i january 2012 (will occur even after SP1 and CumUpd Nov 2011), and is described in more details her (thanks to Boman for sharing this!):

http://wss.boman.biz/Lists/Posts/Post.aspx?ID=82

The reason is an error that occurs when creating new subsites from a customized Site Template. The XML Schema field "ScopeID" doesn't get a correct GUID for the list but instead gets the value "$ListId:Shared Documents;" - hence the error on the attribute "Location". Result: the sourceID field can not identity from which list the document comes from in SharePoint.

NOTE: the value "$ListId:Shared Documents;" is based on the library name used in your customized Site Template, which was "Shared Documents" in my case. In Boman's article the value is "$ListId:Project Documents;" - probably because that was the name of the library in his customized Site Template.

In my scenario I had a site-structure of four levels and all my sites where generated based on customized Site Template, so I needed to check all sites. This is the script I ended up with and it fixed this error on every library in all my sites (this is probably not the best way of coding a recursive loop for 4 levels but it did the job for me -:)):

# This script fixes a bug in Location field in XML Schema for sites created with customized Site Template.
# Checks root sites and 3 levels of subsites.
# Copy this PS file to local SharePOint 2010 server and open Powershell with Import Modules.
# Run at prompt: <path-to-ps1-file>\<name-of-ps1-file>
# Credits to:
http://wss.boman.biz/Lists/Posts/Post.aspx?List=c0143750%2D7a4e%2D4df3%2D9dba%2D8a3651407969&ID=82

function Apply-Fix($siteUrl)
{
    clear
    Add-PSSnapin "Microsoft.SharePoint.Powershell" -ErrorAction SilentlyContinue # -EA 0
    [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
   
    foreach ($spwTarget1 in (Get-SPSite $siteUrl).RootWeb.Webs)
    {
 Write-Host "Checking Web: " $spwTarget1.Url
 foreach($list in $spwTarget1.Lists)
        {
#  Write-Host $list.Title
  $fields = $list.fields
  foreach($field in $fields)
         {
              if($field.SourceId -eq '{$ListId:Shared Documents;}')
              {
    $schemaxml = $field.SchemaXML
                  $schemaxmldata = [xml]$schemaxml
                  $schemaxmldata.Field.SetAttribute("SourceID", $list.ID)
                $schemaxml = $schemaxmldata.get_InnerXml()
                 $field.SchemaXML = $schemaxml
                  $field.Update()
                  Write-Host "Fixed" $field.Title "field"
              }
         }

 }
     foreach ($spwTarget2 in $spwTarget1.Webs)
     {
         Write-Host "Checking Web: " $spwTarget2.Url
  foreach($list in $spwTarget2.Lists)
         {
#   Write-Host $list.Title
   $fields = $list.fields
 
  foreach($field in $fields)
          {
               if($field.SourceId -eq '{$ListId:Shared Documents;}')
               {
      $schemaxml = $field.SchemaXML
                    $schemaxmldata = [xml]$schemaxml
                    $schemaxmldata.Field.SetAttribute("SourceID", $list.ID)
                  $schemaxml = $schemaxmldata.get_InnerXml()
                   $field.SchemaXML = $schemaxml
                    $field.Update()
                   Write-Host "Fixed" $field.Title "field"
               }
          }
  }
  
  foreach ($spwTarget3 in $spwTarget2.Webs)
      {
   Write-Host "Checking Web: " $spwTarget3.Url
   foreach($list in $spwTarge3.Lists)
          {
#    Write-Host $list.Title
    $fields = $list.fields
    foreach($field in $fields)
           {
                if($field.SourceId -eq '{$ListId:Shared Documents;}')
                {
       $schemaxml = $field.SchemaXML
                     $schemaxmldata = [xml]$schemaxml
                     $schemaxmldata.Field.SetAttribute("SourceID", $list.ID)
                   $schemaxml = $schemaxmldata.get_InnerXml()
                    $field.SchemaXML = $schemaxml
                     $field.Update()
                    Write-Host "Fixed" $field.Title "field"
                }
           }
   }

   foreach ($spwTarget4 in $spwTarget3.Webs)
       {
           Write-Host "Checking Web: " $spwTarget4.Url

           foreach($list in $spwTarget4.Lists)
               {
#     Write-Host $list.Title
     $fields = $list.fields
     foreach($field in $fields)
            {
                 if($field.SourceId -eq '{$ListId:Shared Documents;}')
                 {
                    $schemaxml = $field.SchemaXML
                      $schemaxmldata = [xml]$schemaxml
                      $schemaxmldata.Field.SetAttribute("SourceID", $list.ID)
                    $schemaxml = $schemaxmldata.get_InnerXml()
                     $field.SchemaXML = $schemaxml
                      $field.Update()
                     Write-Host "Fixed" $field.Title "field"
                 }
            }

    }
   }
  }
 }
    }
     Write-Host "Done."
}

Apply-Fix -siteUrl "http://your-webname/your-portal-name/"
To use this script: copy all code and save as .ps1 file. Store it on one of your SharePoint 2010 servers. Open Powershell (import system modules) and at PS prompt type:

<path-to-folder-with-ps1-file>\<name-of-ps1-file> and hit ENTER.

You will get an error right after fields that has been modified/fixed for each list, but don't worry - just ignore them:


 Re-run the script again to verify that no fields has the incorrect value ("$ListId:Shared Documents;"). Test and verify in your SharePoint libraries - the DIP should now work OK.

UPDATE May 3, 2012:

Another error with the DIP I encountered (maybe related to the error mentioned above?) was an "Undeclared XSD element" on a Site Column used in a library. All library settings was default (no customization on the DIP or custom Content Types). When a Word document opens the main error appears:
"The Document Informatin Panel was unable to load. The document will continue to load. For more information, contact your system administrator."

The detailed error (I didn't copy it before I resolved it :-( ) explain an error with an Undeclared XSD element with the ID and name of a column (in my case a Site Column).


Solution: removed the Site Column from the library (remember to document the values used per document from the Site Column first in order to re-enter the same values afterwards), and then added it again to the library. Re-enter the same values in the Site Column for each document and the DIP should work again.

Wednesday, March 14, 2012

SharePoint 2007: message "document locked by user or checked out" when document is checked in

Today I experienced the following scenario:

SharePoint 2007 server with a standard document library without versioning and Excel 2007 files. A user could not perform any operations (edit/delete/update) on the document. SharePoint error message appear when trying to edit/delete: the documents cannot be <action> because the document is locked by another user or checked in...

The document library har no versioning activated and the status on the Excel document is NOT checked out, so I could not make the author check it in again. I suspect that a communication error between the authors PC and SharePoint broke the connection between the local copy of the document and SharePoint - thus making SharePoint document status stuck in "locked by another user"...

When opening the Library Settings - Manage Check Out Files the document was not listed there.

Several approaches to this situation:

- checking the local drafts for the user who last edited the document (he used Office 2010 with no local SharePopint drafts folder)
- try a codeplex solution to force check-in and so on

I found an easy way to resolve the deadlock...

Workaround in my case: activate versioning...

1. Open Library Settings for the library with the troublesome document - click on Versioning setting and activate Major Versions - hit OK


2. Now the document can be checked out / edited / deleted again

3. In my case I deleted the file and uploaded the original file from disk

Note: when the author of the document opened the newly uploaded document (with the same file name) he got several options - one of them was to delete a local copy - once this was done he could work with the document in Office as expected.

Thursday, March 8, 2012

SharePoint 2010 list lookup column using Site Columns function

There are several 3-party solutions for doing cross-site lookups but here are OOTB possibilities of a lookup column that can be used on a subsite if the lookup values resides in a list above the site(s) where the column will be used. This is done through Site Columns.

Example site structure:

Home site
       SubSite1
             Subsite1.1
       SubSite2

If you have list(s) in any of these subsites that needs to get values from a global list in the Home site, you can accomplish this by defining a lookup column as a Site Column in the Home site. Define your Site Column lookup to point to the source list and target column with the correct values. The Site Column will be accessable in all subsites and can be added to any list/library using the function "Add from existing site columns" in the receiving list settings.

You maintain a global list of values and the lookup column(s) is updated with changes immediately in every list the columns is being used.

Monday, February 27, 2012

SharePoint 2010, Search result error: The search request was unable to connect to the Search Service

Make sure you have connected your service to the right web application. In our case we added a new Search Service Application to replace an old one, but did not connect it to the correct web application (we had several ones). All services (computer and SharePoint) was started and crawler work fine.

In Central Administration, click Manage Web Applications and highlight your web application. Click Service Connections icon in top menu - our list of connections looked like this where our new service was "Search Service Application Work" and was not connected to our web application:



















Change "deafult" to "custom" and mark all the service applications. Hit OK. Switch to the search results page and refresh - everything should work fine.

SharePoint 2010 in virtual Windows 7 on a MacBook Pro

My MacBook Pro with OS X 10.7.2 has VMWare Fusion 4.1.1 with Windows 7 Pro SP1 x64... And I wanted to include my favorite program SharePoint 2010 also. So I installed SharePoint 2010 Std server on my Windows 7 as described here:

http://msdn.microsoft.com/en-us/library/ee554869%28office.14%29.aspx

I gave my virtual Windows 7 4 GB RAM and it works great. If I want to stop the SQL and SharePoint to release resources I run the following scripts in batch files (.bat):

Stop SharePoint server:

@echo off
@echo Stopping SharePoint 2010 services...
iisreset /stop /noforce
net stop "SharePoint 2010 User Code Host"
net stop "SharePoint 2010 Timer"
net stop "SharePoint 2010 Administration"
net stop "SharePoint Server Search 14"
net stop "SharePoint Foundation Search V4"
net stop "SharePoint 2010 Tracing"
@pause

Stop SQL server:

@echo off
@echo Stopping SQL Express instance...
net stop MSSQL$EXPRESS
@echo Stopping SQL SharePoint instance...
net stop MSSQL$SHAREPOINT
@pause

And the scripts to start them up again:

Start SQL server:

@echo off
@echo Starting SQL Express instance...
net start MSSQL$EXPRESS
@echo Starting SQL SharePoint instance...
net start MSSQL$SHAREPOINT
@pause

Start SharePoint server:

@echo off
@echo Starting SharePoint 2010 services...
iisreset /start /noforce
net start "SharePoint 2010 User Code Host"
net start "SharePoint 2010 Timer"
net start "SharePoint 2010 Administration"
net start "SharePoint Server Search 14"
net start "SharePoint Foundation Search V4"
net start "SharePoint 2010 Tracing"
@pause