public override void ItemAdding(SPItemEventProperties properties)
{
base.ItemAdding(properties);
SPItem itemBeingAdded = properties.ListItem;
var startTime = itemBeingAdded["Start Time"];
// Some code goes here.
}
I am firing this event while adding an item in a calender list. It is getting fired. No problem. But I am not getting any value from properties
. In the above code startTime
gives me nothing. Actually, I want to access the column field of the item (properties
in my case) is being added.
When the user will click in save button, How can I get the column value in code behind (Inside the ItemAdding(SPItemEventProperties properties) method
). Let say, I need Start Time
and End Time
to compare them with some other values. Problem is in the ItemAdding
method. ItemUpdating is working fine.
public override void ItemUpdating(SPItemEventProperties properties)
{
base.ItemUpdating(properties);
SPItem itemBeingAdded = properties.ListItem;
var startTime = itemBeingAdded["Start Time"];
}
SPItemEventProperties
? Is there an entry with the"Start Time"
key? The internal names of fields may be different from what's displayed in the form. – Ondrej TucnySPItemEventProperties
using your debugger's watch capability? – Ondrej Tucny