I have list event receiver which creates item in another list.
Code:
newItem[fieldName1] = cellItem1;
newItem[fieldName2] = cellItem2;
newItem.Update();
The problem is that if any required field is not specified by me, the element will be saved. For example: if the "Title" field is required, but I don't specify newItem["Title"] = cellItem1 - it will still be saved.
I need to prevent this - If a list has required fields and I do not specify their values - Item should not be created.
Yes I can get all list fields and create additional check - If (list.fields[field].Required)..... but may be there are other ways to achieve this?