Skip to main content
added 879 characters in body; added 6 characters in body; added 28 characters in body
Source Link

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

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?

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

I have somea strange situation - if: If the "Require Check Out" and "Create Major Versions" options are switched on for the current DocLibDocument Library, then when iI try to get the CheckOutType property iI receive the exception as shown below.

  •   item.File.CheckOutType  'item.File.CheckOutType' threw an exception of type 'System.NullReferenceException' Microsoft.SharePoint.SPFile.SPCheckOutType {System.NullReferenceException}
    

item.File.CheckOutType 'item.File.CheckOutType' threw an exception of type 'System.NullReferenceException' Microsoft.SharePoint.SPFile.SPCheckOutType {System.NullReferenceException}

Does anyone knows what can beknow the reasoncause of this issue? Thanks.

I have some strange situation - if "Require Check Out" and "Create Major Versions" options switched on for current DocLib, then when i try to get CheckOutType property i receive exception as shown below.

  •   item.File.CheckOutType  'item.File.CheckOutType' threw an exception of type 'System.NullReferenceException' Microsoft.SharePoint.SPFile.SPCheckOutType {System.NullReferenceException}
    

Does anyone knows what can be the reason of this issue? Thanks.

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?

Source Link

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

I have some strange situation - if "Require Check Out" and "Create Major Versions" options switched on for current DocLib, then when i try to get CheckOutType property i receive exception as shown below.

  •   item.File.CheckOutType  'item.File.CheckOutType' threw an exception of type 'System.NullReferenceException' Microsoft.SharePoint.SPFile.SPCheckOutType {System.NullReferenceException}
    

Does anyone knows what can be the reason of this issue? Thanks.