The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

API V2 Update Existing Contact - add to new list

Highlighted
Occasional Advisor

API V2 Update Existing Contact - add to new list

When I try to add contact list to existing contact using .Net wrapper, says the collection is of a fixed size.

 

e.g. myContact.Lists.Add(NewList);

 

Where I looked up the contact, found it exists, but now want to make it a member of a new list.

 

 

4 REPLIES 4
Highlighted
Occasional Advisor

Re: API V2 Update Existing Contact - add to new list

It seems like the fix to this was to create a new contact, copy over fields from found one, then set fields I wanted to set, then I could add the contact list.  Then update workedfine also.

Highlighted
Occasional Contributor

Re: API V2 Update Existing Contact - add to new list

The problem here is that the contact list returns an IList type which is readonly.  Basically, the property can only be set initially during the construction of the object which in the case of an existing contact, the information has already been filled out.

 

if you change the return type of the Lists property to the following:

public List<ContactList> Lists { get; set; } 

 

you'll be good to go.  

 

public IList<ContactList> Lists { get; private set; }  this is what you currently have which will return an error when you try to add to it.

 

I'm saying to change the above on the Contact.cs file in the CTCTWrapper.

Highlighted
Moderator

Re: API V2 Update Existing Contact - add to new list

Thanks for pointing this out.  Will get that looked at.  Hadn't noticed that all of the collection objects have a private set accessor.  Will have an update once we take a look at this.

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Moderator

Re: API V2 Update Existing Contact - add to new list

As we're looking into this, it appears this could be a serialization issue.  Will continue to look at this and see what we need to change to update the repo.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured