I am building an event receiver inside my sharepoint 2013, which get fired when items are updated and the ListTemplateId="100".

as follow:-

 public override void ItemUpdated(SPItemEventProperties properties)


            if (
                ( properties.ListItem["ProjectStatus"] != null &&
                  properties.ListItem["ProjectStatus"] != string.Empty &&
                  properties.ListItem["ProjectStatus"].ToString().ToLower() == "approved" )



Now the problem is that inside the sites which have this event receiver enabled,there are multiple custom lists which the event receiver should not fire on.

For that i am checking if the list contain a column named "ProjectStatus" before modifying the fields inside the event receiver. but the problem I am facing is that let say a custom list item (which does not contain a field named "ProjectStatus") got updated, then my event receiver will raise the following exception :-

Column 'ProjectStatus' does not exist. It may have been deleted by another user.

now i thought when i add the following check inside my If statement :-

properties.ListItem["ProjectStatus"] != null

this will prevent the exception from being raised.. but seems this is not true. so my question is how i can check if the properties.ListItem contain a specific column or not ?


One option is to use ContainsField(string fieldName) method

properties.ListItem.Fields.ContainsField("displayname of the field")

There is also a Contains and ContainsFieldWithStaticName method.

MSDN documentation is here:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.