Getting Hresult 80020009 when Finding Contact by email1Address RRS feed

  • Question

  • I am looping through a list of iCloud contacts stored in Outlook 2013. I want to match the contact with a Contact stored in an Outlook Contact Card where both contacts share the same email address.

    lContact = CType(OutlookContactItems.Find(String.Format("[Email1Address]={0}", iCloudContactItem.Email1Address)), ContactItem)

    Most of the time it works but for some entries VB.Net throws an exception 80020009. Additional information: Cannot parse condition. Error at "@kp". The exact message changes and sometimes looks like "" with the extension.

    iCloudContactItem.email1address =

    Tuesday, February 17, 2015 3:40 AM


  • Hello Paul,

    When filtering text fields, you can use either a pair of single quotes (') or a pair of double quotes (") to delimit the values that are part of the filter. For example, all of the following lines function correctly when the field is of type string:

    sFilter = "[CompanyName] = 'Microsoft'" 
    sFilter = "[CompanyName] = ""Microsoft""" 
    sFilter = "[CompanyName] = " & Chr(34) & "Microsoft" & Chr(34)

    You can read more about the Find method of the Items class in MSDN.

    • Marked as answer by Paul M Cohen Tuesday, February 17, 2015 8:19 AM
    Tuesday, February 17, 2015 8:08 AM