Skip to main content

Attempt to get property CheckOutType of SPFile cause 'System.NullReferenceException' exception

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?