Hey Yohan,
The reason why it comes back empty is because that the list isnt stored in that general collection but in the details of the contact itself. That wrapper will do a GET to "https://api.constantcontact.com/ws/customers/{username}/contacts" but if you use GetContactDetails(); then you can get the information you need.
Please let me know if this helps.
Sorry for the formatting of the original message. I must have had a script blocker on that caused the newlines not to go through, resulting in a single block of text.
And quick correction: I was using GetContactCollection() initially, not "GetContacts()", which was a wrapper method I wrote that calls GetContactCollection(). Sorry for that confusion too.
Thanks for the info. I ended up using Utility.GetContactDetailsById() instead of the more raw GetContactDetails() and it worked great! For the resulting contact I drilled down to Contact.ContactLists and was able to grab the ids of the contact lists and match them up against the desired contact list's id. I wanted to use name instead but the name wasn't populated for each contact list in ContactLists.
The pseudocode is something like this:
GetContactCollection()
for each Contact:
GetContactDetailsById() // use Id of current Contact
for each ContactList:
if ContactList.Id == Id of desired ContactList then
add Contact to list of contacts to process afterward
end if
end for each
end for each
process list of contacts
I think I'm starting to understand the design of the .NET library you put together, and I think I understand why I was having trouble. I'm spoiled by LINQ (particularly LINQ to SQL) where you can continually drill down into an object and keep grabbing more and more related data on the fly, for instance drilling down a contact's ContactLists collection and get the Name for each contact list. Using the CC library there's more manual/explicit fetching of data instead of having it all populated for you. I'm thinking of writing new wrapper methods like:
GetContactCollectionWithDetails()
GetUserContactListCollectionWithContacts()
... that do that extra fetching for me, because the data structures are there to be filled--they're just not getting filled in a single step.
Anyway, thanks again for your help.
The holidays have come and gone. For many seasonal businesses, this means the rush of shoppers has decreased as well. Instead of turning off the lights and waiting for spring, make your email marketi...
See Article