Friday, December 2, 2011

Powershell - Non CLS compliant type


Error:
The field/property: "Id" for type: "Microsoft.SharePoint.Administration.SPContentDatabase" differs only in case from the field/property: "ID". Failed to use non CLS compliant type.
Solution:
The way that you have to work around this issue is to get a handle to the type’s property using reflection and then invoke the SetValue() method.
$maxProp = [Microsoft.SharePoint.Administration.SPContentDatabase].GetProperty("MaximumSiteCount")
$maxProp.SetValue($siteCol.ContentDatabase, 1, $null)
If you want to get the property value:
$returnVal = $maxProp.GetValue($siteCol.ContentDatabase, $null)

Reference : 

No comments:

Post a Comment