cancel
Showing results for 
Search instead for 
Did you mean: 

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
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.

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.

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
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