SharePoint 2010: Content deployment fails with SPInvalidPropertyException

Symptoms

Consider the following scenario:

- You have two MOSS 2007 farms with content deployment jobs that push content from a source farm to a destination farm.

- You upgrade both farms to SharePoint Server 2010

- You enable usage analytics processing only on the source farm

Once the monthly site usage total bandwidth exceeds 2 gigabytes, the next incremental content deployment job will fail with the following error: 

The exception thrown was 'Microsoft.SharePoint.SPInvalidPropertyException': 'Specified data type does not match the current data type of the property.'

Cause

Since the destination farm’s usage analytics processing is disabled and the timer job has not been run yet, it is leaving the vti_siteusagetotalbandwidth property of the root web using the Int32 data type created by MOSS 2007. SharePoint Server 2010 uses Int64 data type which is stored as a string. The content deployment fails due to a conversion error from Int64 to Int32 when the value is bigger than Int32.MaxValue (2147483647).

Resolution

Using the following PowerShell script executed in a SharePoint Administration console you can convert vti_siteusagetotalbandwidth property to String in every site collection in a farm. You have to execute it once on each destination farm after they are upgraded from MOSS 2007 to avoid the SPInvalidPropertyException.

get-spsite -limit all | % {
    write-host $_.Url
    $web = $_.RootWeb
    $item = $web.AllProperties["vti_siteusagetotalbandwidth"]
    if ($item -ne $null -and $item.GetType().Name -ne "String") {
       
        $itemstr = $item.toString();
        Write-host "Converting value  $itemstr at  $($web.Url) ";
        $web.AllProperties.Remove("vti_siteusagetotalbandwidth");
        $web.Update();
        $web.AllProperties.Add("vti_siteusagetotalbandwidth",[System.String]$itemstr);
        $web.Update();
    }
    $web.Close();
    $site.Close();
}
Properties

Article ID: 2671324 - Last Review: Feb 6, 2012 - Revision: 1

Microsoft SharePoint Server 2010

Feedback