我需要立即創建併發送MailChimp.com
中的廣告系列。爲此我使用了C# wrapper Percepective MCAPI.dll
。如何使用ASP.Net在MailChimp中創建廣告系列
從MailChimp API,它清楚,我們不能列出,但可以創建活動。我試過代碼,但campaignID is retured null
;至少不會拋出異常。我確實設置了campaigntype to Auto
。
這裏是我的代碼片段:
try { string apiKey = "api-us2"; // API KEY is valid string emailAddress = "[email protected]"; listsForEmailInput lstForEmailInput = new listsForEmailInput(apiKey, emailAddress); listsForEmail cmd = new listsForEmail(lstForEmailInput); listsForEmailOutput lstEmailOutPut = cmd.Execute(); List lstResults = lstEmailOutPut.result; string listID = lstResults[0]; // Got Precraeted List ID(Valid Confirmed) Console.WriteLine("\n" + listID); // compaign Create campaignCreateOptions campaignCreateOpt = new campaignCreateOptions(); campaignCreateOpt.list_id = listID; campaignCreateOpt.subject = " New Campaign from dev_Anil"; campaignCreateOpt.from_email = "[email protected]"; campaignCreateOpt.from_name = "anil"; Dictionary content = new Dictionary(); content.Add("html", "Helloaasdsa"); content.Add("text", "Hi all !! this is dev_anil"); content.Add("url", ""); content.Add("archive", ""); campaignSegmentOptions csOptions = new campaignSegmentOptions(); csOptions.match = "any"; // Could not set Condition -- need help for this // Need to set a Dictionary typeOptions because null is not supported Dictionary typeOptions = new Dictionary(); campaignCreateParms campaignCreateParms = new campaignCreateParms(apiKey, EnumValues.campaign_type.auto, campaignCreateOpt, content, csOptions, typeOptions); campaignCreateInput campaignCreateInput = new campaignCreateInput(campaignCreateParms); campaignCreate campaignCreate = new campaignCreate(campaignCreateInput); campaignCreateOutput ccOutput = campaignCreate.Execute(campaignCreateInput); string abc = ccOutput.result; // This comes out to null } catch(Exception ee) { Console.WriteLine("\n\n Exception :" + ee.Message); // no exception }
有誰能夠告訴我正確的方向,什麼是錯的代碼。
任何幫助將不勝感激。
謝謝。
:L錯誤506:自動回覆僅在每月可用的和付費爲你去賬戶。 – Edd 2012-07-12 13:11:43