Hi there.
I'm trying to replicate the same behaviour as illustrated here: https://community.constantcontact.com/t5/Developer-Support-ask-questions/C-Error-Checking-if-Contact...
however when I use the sample code provided by Shannon W, I get the above error.
Any idea why this isn't working for me?
Regards,
Arthur
Hi Arthur,
This is going to be because that sample was created before the wrapper was expanded to allow filtering by contact status. The current definition for the overload that you want is:
public ResultSet<Contact> GetContacts(string email, int? limit, DateTime? modifiedSince, ContactStatus? status)
So in order to use this, you would want to build the code like this:
private Contact GetContactByEmailAddress(string emailAddress) { ResultSet<Contact> contacts = _constantContact.GetContacts(emailAddress, 1, null, null); if (contacts != null) { if (contacts.Results != null && contacts.Results.Count > 0) { return contacts.Results[0]; } } return null; }
If you run into any issues with this, please let me know!
Sincerely,