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.

CTCT exception while doing AddList

SOLVED
Go to solution
Highlighted
Occasional Contributor

CTCT exception while doing AddList

Hello,

 

I am trying to build a VB.NET console application with capability of adding new List.

 

Dim contact As Contact = Nothing
Dim result As Contact = Nothing
Dim alreadyExists As Boolean = If(contact IsNot Nothing, True, False)
Dim CClist As ContactList = Nothing
If String.IsNullOrEmpty(_AccessToken) Then
Exit Sub
Else
_CC = New ConstantContact(_APIKey, _AccessToken)
CClist = New ContactList
CClist.Id = "1"
CClist.Name = "Samplelist"
CClist.Status = "ACTIVE"
_CC.AddList(CClist)
End If

 The List has been created successfully, but I got the below Exception.

 

{CtctException thrown: Error message: Exception of type 'CTCT.Exceptions.CtctException' was thrown.}
Capacity: 98
Chars: In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.
DefaultCapacity: 16
Length: 98
m_ChunkChars: {Length=66}
m_ChunkLength: 66
m_ChunkOffset: 32
m_ChunkPrevious: {CtctException thrown: Error mess}
m_MaxCapacity: 2147483647
MaxCapacity: 2147483647
MaxChunkSize: 8000

 

Any help to fix this error is highly appreciated.

 

Thanks

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Advisor

Re: CTCT exception while doing AddList

Yes, that is exactly what I am seeing as the issue with the wrapper code.  It is not handling the return codes properly.

 

If you want, I've attached my wrapper code in a zip file that has corrected (I believe) the issues.  I've not tested everything, mostly creating/retrieving campaigns and getting Contact Lists, but you are welcome to use this updated code while we wait for them to update the GitHub site with a working version.

 

View solution in original post

7 REPLIES 7
Highlighted
Honored Contributor

Re: CTCT exception while doing AddList

Hello,

 

Based on the information provided here, the first thing that you will want to do is remove the line CCList.Id = "1". The reason for this is that each new list in Constant Contact has an ID automatically assigned. Becuase of this, you cannot specify your own list ID when creating a new list with this method.

 

If you continue to have trouble, please let us know!

 

Best Regards,

 

 

Elijah G.
API Support Engineer
Highlighted
Occasional Contributor

Re: CTCT exception while doing AddList

Elijah,

 

Thanks for your reply.

 

As I said earlier, the list was created and I got the error. Below is create JSON from AddList method

 

{\"name\":\"TestList0\",\"status\":\"ACTIVE\"}

 

Thanks

Kumar

Highlighted
Occasional Advisor

Re: CTCT exception while doing AddList

If you are using the .NET SDK, take a look at the HttpRequest method in the RestClient Class of the CTCTWrapper project (..\.net-sdk-master\TCTWrapper\Util\RestClient.cs).  Look to see if the method is throwing an exception when the response.StatusCode is not equal to HttpStatusCode.OK.

 

If you find that it is throwing an exception in this situation, then this is probably what is causing your issue.  Creating a List returns HttpStatusCode.Created response code rather than HttpStatusCode.OK.

 

Highlighted
Occasional Contributor

Re: CTCT exception while doing AddList

Hi KarlH

 

In that said method, urlReponse.StatusCode returns created, not OK

 

WebException.JPG

Highlighted
Occasional Advisor

Re: CTCT exception while doing AddList

Yes, that is exactly what I am seeing as the issue with the wrapper code.  It is not handling the return codes properly.

 

If you want, I've attached my wrapper code in a zip file that has corrected (I believe) the issues.  I've not tested everything, mostly creating/retrieving campaigns and getting Contact Lists, but you are welcome to use this updated code while we wait for them to update the GitHub site with a working version.

 

View solution in original post

Highlighted
Occasional Contributor

Re: CTCT exception while doing AddList

KarlH,

 

Thank you !

 

The given Wrapper code fixed the issue.

 

Thanks for your help. I am continue to explore more on this CTCT.dll's usages

Highlighted
Honored Contributor

Re: CTCT exception while doing AddList

Hello Karl and Kumar,

 

Thank you for reporting this issue. The problem was that a number of success statuses returned by the API were not properly handled in the SDK. This issue has been corrected in the SDK with an update that was merged today on github. you can view the details of the change here: https://github.com/constantcontact/.net-sdk/pull/33

 

Best Regards,

Elijah G.
API Support Engineer
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