How to I check to see if a contact is in a contact list? I'm looking at contact.Lists.Exists where contact is my Contact, but having trouble in figuring out to use the right syntax. I've tried:
// Do Something
but know this is not correct. What is the correct syntax? Thanks.
Another way I'm looking at is by getting the contacts from a list using getcontactsfromlist. Can I use Results.Contains to check if a users email address is in the list? If so, what is the correct syntax? What I have so far is:
<Contact> contacts = cc.GetContactsFromList("22", DateTime.Now.AddMonths(-1));
I know it will then begin with contacts.Results.Contains. What do I put for the item?
If you're looking for a specific contacts information, it's likely easier to just search for that email address using our search feature. You can find more information on that on this page in the documentation: http://developer.constantcontact.com/docs/contacts-api/contacts-collection.html
In the .Net wrapper, you would use the GetContacts() method and provide an optional email address to search for. This will let you know if the Contact exists and get you information on said Contact.
Thanks for posting. The Contains method requires an argument of the same type that the List is. So you would have to create a new Contact object to perform the search. I would advise against this way of searching. The Contains method will search for a complete, perfect match of objects, not just one field. A good way to search would be to iterate through the list and compare each object's email address(es) against what you are looking for. Hope that helps.