So the app I am working on pulls a specific outlook contact and displays the props. The issue I am running into is if the email address field is present becuase a contact may not have an email address and I need to check for this. The error message that is being returned is {“The given key was not present in the dictionary.”}.
Below is the code. So it’s complaning that the email address key is not present so it cannot assign it. So how do i check if the email key is present prior to the assignment?
EWSForm.EmailAddresses = Contact.EmailAddresses[EmailAddressKey.EmailAddress1].Address;
Since EmailAddresses is of type EmailAddressDictionary and from the MSDN documentation:
You should be able to do this (Use the
Contains(Key)method as defined here http://msdn.microsoft.com/en-us/library/dd634144(v=exchg.80).aspx):