danesparza / MailChimp.NET

:envelope: .NET Wrapper for the MailChimp v2.0 API
MIT License
179 stars 119 forks source link

System.Runtime.Serialization.SerializationException #203

Open serena-alfapi opened 7 years ago

serena-alfapi commented 7 years ago

Hi,

when I try to create a campaign, I receive this error:

Type definitions should start with a '{', expecting serialized type 'ApiError', got string starting with:

Access Denied

<

Site hosted on smarterasp.net.

Please, Help me! thank you for all kind of support!

danesparza commented 7 years ago

Hmmm ... can you do any operations with Mailchimp? What operations appear to work -- which don't?

serena-alfapi commented 7 years ago

Thank's for reply. Yes I can do everything. It's possible to create and send a campaing using mailchimp site.

This is the code I use to send using vb.net:

Imports MailChimp (using Nuget MailChimp.NET)

Public Shared Function AUTOMATIC_MAILCHIMP_SEND(ByVal _url As String, ByVal _oggetto As String, ByVal listId As String, ByVal _d As String) As String Dim _esito As String Dim apiKey As String = "XXXXXXXXX" Dim mc As MailChimpManager = New MailChimpManager(apiKey) Dim messaggio As New MailChimp.Campaigns.CampaignCreateContent Dim _d2() As String Dim _destinatari As New List(Of String)

_d2 = Split(_d, ";") For _i = 0 To _d2.Count - 1 _destinatari.Add(_d2(_i)) Next

messaggio.Url = _url (the url where I saved newsletter.htm in the same server) Dim options As New MailChimp.Campaigns.CampaignCreateOptions With options .ListId = listId .Subject = _oggetto .FromEmail = "XXX@XXX.com" .FromName = "XXXXX" End With Dim campagna As New MailChimp.Campaigns.Campaign campagna = mc.CreateCampaign("regular", options, messaggio) Dim campagnaid As String = campagna.Id Dim result As New MailChimp.Campaigns.CampaignActionResult

============================= ERROR HERE =============================

result = mc.SendCampaignTest(campagnaid, _destinatari)

===================================================================

Select Case result.Complete.ToString Case "True" _esito = "ok"

Case Else _esito = "KO" End Select

Return _esito End Function

thank's