2012-05-09 1 views
4

こんにちは、私のメーリングリストに登録すると、私の顧客をグループ化して助けてくれる人がいますか?これは私が今まで持っていたものです。GROUPINGオプションなしで動作します...Mailchimp ASP.NET VB List Subscribe PerceptiveMCAPIを使用したグループ化

  Dim newlistSubscribeParms As New listSubscribeParms() 
      newlistSubscribeParms.apikey = "xxx" 
      newlistSubscribeParms.id = "xxx" 
      newlistSubscribeParms.email_address = txtEmailAddress.Text 
      newlistSubscribeParms.double_optin = False 
      newlistSubscribeParms.email_type = EnumValues.emailType.html 
      newlistSubscribeParms.replace_interests = True 
      newlistSubscribeParms.send_welcome = False 
      newlistSubscribeParms.update_existing = True 
      newlistSubscribeParms.merge_vars.Add("FNAME", txtFirstName.Text) 
      newlistSubscribeParms.merge_vars.Add("LNAME", txtLastName.Text) 
      newlistSubscribeParms.merge_vars.Add("GROUPINGS", "??") 

      Dim newlistSubscribeInput As New listSubscribeInput(newlistSubscribeParms) 
      Dim subscribeSuccess = cmd.Execute(newlistSubscribeInput) 

私はこのコードが「Quote Request Customers」のサブグループに顧客を追加する4つのサブグループ「Audience」と呼ばれるこのリスト内およびそのグループ内の一つのメインのグループを持っている...

Imが使用して知覚MCAPI

私はドキュメンテーションを見て回っていました。私は何か動作するよう苦労しています。

ありがとうございました

答えて

4

私は今問題を解決しました!

このコードを参照してくださいが、C#で書かれている、私はあなたがそれを理解することを願って:あなたのケースでは

//from page 12 of "PerceptiveMCAPI Documentation" 
        /* 
         listSubscribe 
          Merge_vars are defined as Dictionary<string, object> where: 
          • If the string name is Groupings, the object value expected is of type: List<interestGroupings> 
          • If the object type is DateTime, the value is converted to an acceptable api string equivalent 
          • if the object type is Dictionary<string, object> (used for address array), the Key‐Value pairs are 
           formated as required 
          • Any other object type is passed to the api as‐is. 
        */ 

       //first association of groups for father group "DataGenerazioneContatto" 
       List<string> _groups_for_DataGenerazioneContatto = new List<string>(); 
       _groups_for_DataGenerazioneContatto.Add(DateTime.Now.ToShortDateString()); //today 

       //second association of groups for father group "TipoMail" 
       List<string> _groups_for_TipoMail = new List<string>(); 
       _groups_for_TipoMail.Add("Generica"); //choose ONE or MORE from "Generica" & "Personale" 
       _groups_for_TipoMail.Add("Personale"); 

       List<interestGroupings> _listGroupings = new List<interestGroupings>(); 
       _listGroupings.Add(new interestGroupings { name = "DataGenerazioneContatto", groups = _groups_for_DataGenerazioneContatto }); 
       _listGroupings.Add(new interestGroupings { name = "TipoMail", groups = _groups_for_TipoMail }); 

       listSubscribeParms _listSubscribeParms = new listSubscribeParms(); 
       _listSubscribeParms.apikey = apikey; //your MailChimp apikey 
       _listSubscribeParms.id = _listID;  //the ID of the selected MailChimp List 
       _listSubscribeParms.email_address = "[email protected]"; 
       _listSubscribeParms.double_optin = false; 
       _listSubscribeParms.email_type = EnumValues.emailType.html; 
       _listSubscribeParms.replace_interests = true; 
       _listSubscribeParms.send_welcome = false; 
       _listSubscribeParms.update_existing = true; 
       _listSubscribeParms.merge_vars.Add("FNAME", "NameTest2"); 
       _listSubscribeParms.merge_vars.Add("LNAME", "SurnameTest2"); 
       _listSubscribeParms.merge_vars.Add("GROUPINGS", _listGroupings); 

       listSubscribe _listSubscribe = new listSubscribe(new listSubscribeInput(_listSubscribeParms)); 
       listSubscribeOutput _listSubscribeOutput = _listSubscribe.Execute(); 

(C#の場合)、それは次のようになります。

List<string> _groups_for_Audience = new List<string>(); 
    _groups_for_Audience.Add("Quote Request Customers"); //you can add more than one 

    List<interestGroupings> _listGroupings = new List<interestGroupings>(); 
    _listGroupings.Add(new interestGroupings { name = "Audience", groups = _groups_for_Audience }); 

    newlistSubscribeParms.merge_vars.Add("GROUPINGS", _listGroupings); 
関連する問題