i want to show an error message, whenever the user adds an item. So i use code similar to that:
public override void ItemAdding(SPItemEventProperties properties)
{
properties.Cancel = true;
properties.ErroMessage = properties.AfterProperties[columnname];
}
Unfortunately it only work, when the columname ist an default column. For self defined columns it doesn't work. I get this error message:
event receiver has canceled the request
I tried everything: The columnname is right, the column is not null,.. If i write a console application getting this columns, everything will work well. Only in the event receiver it doesn't work.
Can anybody help? Would be great!