Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

There is a boolean column I added to a custom list, but I also have a feature on this custom list so that when a Item is added i have to check if this column exists or not and then its value.

now i am using this code,

 class GetCustomerDetails : SPItemEventReceiver
    {
        public override void ItemAdded(SPItemEventProperties properties)
        {
            if ((bool)properties.ListItem.Properties["Invoice Generated"] == true)
            {
            }
         }
    }

how can i check if this property exists before checking its value and if am checking property value right way.

share|improve this question
add comment

1 Answer

You can use the properties.ListItem.Fields to get the SPFieldCollection and check for the existence of your field in the collection.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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