This topic has not yet been rated - Rate this topic

SPItemEventProperties.ListItem Property

Gets the list item that is associated with the event that occurred.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
public SPListItem ListItem { get; }

Property Value

Type: Microsoft.SharePoint.SPListItem
The SPListItem object associated with the event.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
ListItem is null when ...
within SPItemEventReceiver.ItemAdding and SPItemEventReceiver.ItemDeleted the properties.ListItem is null.
ItemDeleted
ListItem data member is null, Should not this be mentioned in the documentation !!

How can I know the unique id (GUID) of the deleted item then ?
Remark: This property returns null while updating a folder in the list.
You call Folder.Update() in a list.
ListItemUpdating Event receiver executes :

public override void ItemUpdating(SPItemEventProperties properties)
{
base.ItemUpdating(properties);
//ListItem is null if you are updating a folder
if(properties.ListItem==null )
{
// do something about the folder being updated
}
//
//your custom code can go here
//
}