Tuesday, June 8, 2010

Using SharePoint 2010 Developer Dashboard for Debugging and Performance Monitoring

Basically, we can use the following code pattern:

    using (new SPMonitoredScope("My code block (WebPart1)"))
    {
        // the code to be monitored here
    }


Please see the blog from Waldek Mastykarz for detail.

Wednesday, June 2, 2010

SharePoint 2007 Auditing Feature, Site Collection Level Auditing and List/Library Level Auditing

Quick steps:
  1. Create a policy at the site collection level: click on Site collection policies under Site Collection Administration of the site collection Site Settings.
  2. Within the same site collection, go to the list/library to be audited
  3. Go to Settings of the list/library, select Information management policy settings under Permissions and Management
  4. Select the policy from step 1
Note: site collection auditing NEEDs to be enabled. Audit log reports is only available at the site collection level. And audit logs take additional content database space.

Also there are 3 good article on MSDN about auditing:
Don't forget to trim the audit log, this tool SharePoint Audit Log Tool from codeplex can help.

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.