SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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.