Error while updating Campagin Content

Mar 2, 2011 at 1:44 PM
Edited Mar 2, 2011 at 1:45 PM

Hi, i am new at using MC Api. We have dynamic content from database and what i want to do is to update the campaign from our database on daily basis, just like a newsletter. There is an error when I am using below code snippet



       Dim input As New campaignUpdateInput

       input.parms.apikey = apikey


       input.api_AccessType = EnumValues.AccessType.Serial

       input.api_OutputType = EnumValues.OutputType.XML

       input.parms.cid = "123456" = "Newsletter Test"


       Dim val As New Dictionary(Of String, String)

        val.Add("mainKicker", mainkicker)

       val.Add("mainHeading", mainHeading)

       val.Add("mainSummary", mainSummary)


       input.parms.value = val

       Dim cmd As New campaignUpdate(input)


       Dim output As campaignUpdateOutput

       output = cmd.Execute()



where mainKicker, mainHeading and mainSummary are the ids of the divs with mc:edit in the template


The error is

Index and length must refer to a location within the string.
Parameter name: length


What I understand with “cid” is campaign id and I get it from the URL when working on it.


Please update me what I am doing wrong and what I am missing, any help will be appreciated



Mar 3, 2011 at 1:37 PM

The main thing you are doing wrong, is not researching the documentation and forums thoroughly I suspect. 
If you haven't already, you might want to join the api discussion groups on google as a good place to pick up info. 

Firstly, the campaign id is NOT what you see in the url, that's the webid -- it's been discussed a number of times in the forums and kb articles.
Secondly, in the campaignCreate() command documentation it explains the naming you have to use when updating template section content -- prepending "html_" is the point there.
Thirdly, in my documentation for campaignUpdate() - page 11 - it gives as good a description as I've got on the way to handle the various name/value definitions for wrapper parameters.

Go through those and I think you'll find the answers you're looking for.