Friday, May 28, 2010

Using Session State in SharePoint 2010 - Mark Arend - Site Home - MSDN Blogs

Very good article. In summary, it explains the difference between ASP.NET Session State and State Service and how to enable ASP.NET Session State and it's implications.

If your custom SharePoint code uses ASP.NET session, please be aware of this.

Link to the article

Thursday, May 27, 2010

Date Comparison in FullTextSqlQuery

I found this forum discussion.

Basically according to Steve Curran, the date literal must be surrounded by single quotes and formatted in YYYY-MM-DD format. Note this format does not address date with time value. However, even with this format, the = comparison does not work, for example, reportDate = '2010-05-24'. The >= comparison works.

In order to make equal comparison work, I had to combine > and < together. For example:

reportDate > inputDate.AddDays(-1).ToString("yyyy-MM-dd") and reportDate < inputDate.AddDays(1).ToString("yyyy-MM-dd")

The reportDate is a Date and Time field with Date Only format.

If you know any other approaches, please let me know.

Update: Also find this blog by about datetime comparison. Must read if you do datetime comparison in custom search web part.

Monday, May 24, 2010

preupgradecheck Common Issue Resolution

From George Khalil:

Upgrading your Content DB to SharePoint 2010 – Part 1, The preupgradecheck

Lots of great information on solving some common problems reported by preupgradecheck, such as missing site definition, missing feature, etc. 

SharePoint 2010 Custom Error Page Implementation

Todd's Blog | An Expected Error Has Occurred

SharePoint Content Database Detach Attach Tips

Recently I upgraded SharePoint 2007 farm from SP1 to SP2. I took the hybrid approach, i.e., I detached the content databases before the binary upgrade, then attached those content databases after the binary upgrade. All went well other than one issue and one interesting observation.

The issue: for all the content databases, we have custom value for "Site Level Warning" and "Maximum Number of Sites", after detach and attach, the custom values are gone and I had to create a simple console application to update those values. I could do this manually via central administration, but we have many content databases.

So don't forget to set those values if those values are customized.

The observation: In Central Administration > Application Management > Content databases, you can set the value for Site Level Warning and Maximum Number of Sites to the same value, even the Manage Content Database Settings page says in red on the top "The database capacity setting values must be greater than the number of existing sites in the database, and warning site count must be less than the maximum site count.". Very strange. Maybe just a bug in the UI.

Thursday, May 20, 2010

Content Databse with Modified database schemas

"stsadm -o preupgradecheck" reports that "Failed: Content Databse with Modified database schemas".

Options to fix:

  • User SharePoint Central Administration to backup and restore the questioned content databases to a new content database.
  • Use stsadm mergecontentdbs to the sitecollections in the questioned content database to a new content database.

Moving All SharePoint Databases to a New Database Server

Using backup and restore. Here is the procedure from Steven Haden's Blog:

  1. Using the SharePoint Central Admin, make a full backup the whole farm.
  2. Start the SharePoint Products and Technologies Configuration Wizard and disconnect the web server from the farm
  3. Using the SharePoint Products and Technologies Configuration Wizard define a new farm in the SQL server, that creates a new configuration database
  4. (Updated) Using the SharePoint Central Admin restore the full backup in your new farm, running it twice. Select New configuration to be able to change the Database name.
    1. Restore first the content database
    2. Restore the SSP and its content
Or this article from TechNet:

Move All Databases

When building a new farm, we should consider using sql connection alias to add a layer of abstraction between SharePoint servers and database server.