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
Solved! Go to Solution.
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.
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,
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
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.
Hi KarlH
In that said method, urlReponse.StatusCode returns created, not OK
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.
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
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,
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