I have a strange situation: If the "Require Check Out" and "Create Major Versions" options are switched on for the current Document Library, then when I try to get the CheckOutType property I receive the exception shown below.
item.File.CheckOutType 'item.File.CheckOutType' threw an exception of type 'System.NullReferenceException' Microsoft.SharePoint.SPFile.SPCheckOutType {System.NullReferenceException}
Does anyone know the cause of this issue?
UPD: I use SharePoint 2010, RTM. Here is the code, which cause the exception:
if (item.File.CheckOutType == SPFile.SPCheckOutType.None)
{
//Something else here;
}
And here is Exception StackTrace:
" at Microsoft.SharePoint.Library.SPRequest.GetFileAndFolderProperties(String bstrUrl, String bstrStartUrl, ListDocsFlags ListDocsFlags, Boolean bThrowException, Int32& phrStatus, Object& pvarFiles, Object& pvarDirs, UInt32& pdwNumberOfFiles, UInt32& pdwNumberOfDirs)\r\n at Microsoft.SharePoint.SPWeb.GetFileOrFolderProperties(String strUrl, ListDocsFlags listDocsFlags, Boolean throwException, SPBasePermissions& permMask)\r\n at Microsoft.SharePoint.SPFile.PropertiesCore(Boolean throwException)\r\n at Microsoft.SharePoint.SPFile.get_CheckOutType()\r\n at My Method here " string