campaignmonitor/createsend-dotnet

Create Campaign Error:4101

ArifurKhan opened this issue · 4 comments

Hi,

I integrated the campaign monitor api in our project. In our local server, everything is fine and campaign is created successfully. But when it is in production, then it behaves abnormally. sometimes it is giving 4101 code ( singleline tag missing, but in the html, singleline tag exists ), but in the next try, it is created campaign with the same html.

Can anyone suggest, what can be the reason?

Sorry to hear you are having issues.

Can you show an example of the code you are using (with API keys and other IDs removed)?

here is the main function. Please note that I am sending an html template which contains some image links, and so I am sending emplty singlelines and multilines.

my html link is : https://agent.condonow.com/emailtemplates/buyline%20for%20Agents/buyline-email-template.html

private string CreateFromTemplate(AuthenticationDetails auth, string TemplateURL, string cid, string listid, string subject, string campaignname, string fromName, string fromEmail, string replyTo)
{
try
{
List listIDs = new List();
listIDs.Add(listid);

            Subscriber scr = new Subscriber(auth, listid);

            List<string> segmentIDs = new List<string>();
            //string segmentid = Segment.Create(auth, listid, campaignname, null);
            //segmentIDs.Add(segmentid);

            TemplateContent templateContent = new TemplateContent();

            List<EditableField> singlelines = new List<EditableField>();
            EditableField singleline = new EditableField();
            singleline.Content = "";

            singlelines.Add(singleline);
            templateContent.Singlelines = singlelines;

            List<EditableField> multilines = new List<EditableField>();
            EditableField multiline = new EditableField();
            multiline.Content = "";
            multilines.Add(multiline);
            templateContent.Multilines = multilines;

            string NewTemplateID = Template.Create(auth, cid, campaignname, TemplateURL, null);

            HttpContext.Current.Session["NewTemplateID"] = NewTemplateID; 

            string campaignID = Campaign.CreateFromTemplate(
                auth,
               cid,
                subject,
                campaignname,
                fromName,
                fromEmail,
                replyTo,
                listIDs,
                segmentIDs,
                NewTemplateID,
                templateContent);

            return campaignID;

        }
        catch (CreatesendException ex)
        {
            ElmahErrorFacade.Add(ex, "CampainMonitor.CreateFromTemplate");
            return ex.Message.ToString();
        }

    }

OK, so that error is likely originating from the Template.Create call rather than the Campaign.CreateFromTemplate call.

One possible explanation of what you are seeing is that for some invocations of Template.Create the campaign monitor API is having issues accessing TemplateURL . Is it possible that the web server serving up TemplateURL perhaps had some issues / downtime when the call to Template.Create failed?

Thanks for your reply Mr. Wills.

But I am afraid there is no possibility of error about the template url or template content. Do you have any other idea?