Home > Sharepoint 2007 > properties.ListItem in ItemAdded is NULL – Workaround to get ListItem

properties.ListItem in ItemAdded is NULL – Workaround to get ListItem

i saw this question alot on forums and decided to BLOG it for quick reference. This is a known issue and will be addressed in future. However it is very common that one need ListItem object in ItemAdded event. Workaround is to get the Listitem using ListItemId and spList.GetItemById. here is code snippet
 
   SPWeb oSPWeb = properties.OpenWeb();
   SPListItem oListItem = oSPWeb.Lists[properties.ListId].GetItemById(properties.ListItemId);

 

About these ads
Categories: Sharepoint 2007
  1. Aj
    September 28, 2011 at 3:28 pm

    Thank you very much. It worked

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: