Monday, November 24, 2008

Using BeforeProperties and AferProperties of ListItem Event Handler

Accessing Property of a list item directly

Public override void ItemAdded(SPItemEventProperties property)
{
string titlePro=properties.AfterProperties["Title"].toString();
int idProperty=conver.toInt32(properties.AfterProperties["Title"].toString());
}

Looping through property collection

Public override void ItemAdded(SPItemEventProperties property)
{
SPItemEventDataCollection propertyCollection=properties.AfterProperties;
foreach(DictionaryEntry entry in propertyCollection)
{
string filedName=entry.key.toString();
string fieldValue=entry.Value.toString();
}
}

No comments:

Post a Comment