I was able to find outlook conctacts by firstname and lastname this way:
Outlook.ContactItem contact = (Outlook.ContactItem)contactItems.Find(String.Format("[FirstName]='{0}' or "+ "[LastName]='{0}'", namePart));
Now since I am looking for a contact via emailaddress I thought this should work, but it doesn't:
Outlook.ContactItem contact =(Outlook.ContactItem)contactItems.Find(String.Format("[Email1Address]='{0}'", namePart));
But unfortunately it won't find the contact, there is, with the email address passed to the method and filled into namePart.
Can anyone tell me, where my mistake lies? Thanks in advance!
Are you sure ContactItem.Email1Address has the expected value? Did you make sure of that in OutlookSpy (I am its author)? Select the matching contact, click Item button on the OutlookSpy ribbon, select the
Email1Address
property.If you added the contact from GAL,
Email1Address
will beEX
type address, not the (expected)SMTP
.