Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用PerceptiveMCAPI for MailChimp从组中删除电子邮件id_C#_Mailchimp - Fatal编程技术网

C# 使用PerceptiveMCAPI for MailChimp从组中删除电子邮件id

C# 使用PerceptiveMCAPI for MailChimp从组中删除电子邮件id,c#,mailchimp,C#,Mailchimp,我已经编写了以下代码,以从我的MailChimp帐户获取列表及其组,并使用PerceptiveMCAPI在多个组下订阅用户。我可以订阅没有任何问题的组,而我无法从特定组中删除该用户。我尝试使用listUpdateMember和update_现有属性,但没有任何效果 代码如下: public partial class Signup : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e)

我已经编写了以下代码,以从我的MailChimp帐户获取列表及其组,并使用PerceptiveMCAPI在多个组下订阅用户。我可以订阅没有任何问题的组,而我无法从特定组中删除该用户。我尝试使用listUpdateMember和update_现有属性,但没有任何效果

代码如下:

public partial class Signup : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            this.GetList();
        }

    }

    protected void btnSubscribe_Click(object sender, EventArgs e)
    {
        Dictionary<string, object> dic = new Dictionary<string, object>();
        List<interestGroupings> lst = new List<interestGroupings>();           
        for (int i = 0; i <= chkGroups.Items.Count - 1;i++ )
        {
            if (chkGroups.Items[i].Selected)
            {
                lst.Add(new interestGroupings { id = Convert.ToInt32(chkGroups.Items[i].Value), name = chkGroups.Items[i].Text, groups = new List<string> { chkGroups.Items[i].Text } });
            }
        }
        dic.Add("GROUPINGS", lst);            

        listSubscribeParms param = new listSubscribeParms();
        param.email_address = txtEmail.Text;
        param.email_type = EnumValues.emailType.html;
        param.apikey = MCAPISettings.default_apikey;
        param.id = drpList.SelectedValue;
        param.merge_vars = dic;
        //param.update_existing = true;
        listSubscribeInput subInput = new listSubscribeInput(param);
        listSubscribe sub = new listSubscribe(subInput);
        listSubscribeOutput subOutput = sub.Execute();
        if (subOutput.result)
            Response.Write("Congrats! a confirmation email has been sent to your email id");
        else
        {
            listUpdateMemberParms upparam = new listUpdateMemberParms(MCAPISettings.default_apikey,param.id, param.email_address, param.merge_vars, EnumValues.emailType.html,true);
            this.UpdateMember(upparam);
        }
    }

    private void UpdateMember(listUpdateMemberParms param)
    {            
        listMemberInfoInput memInput = new listMemberInfoInput(MCAPISettings.default_apikey, param.id, param.email_address);
        listMemberInfo memInfo = new listMemberInfo();
        listMemberInfoOutput memOutput = memInfo.Execute(memInput);

        param.email_address = memOutput.result.id;
        param.replace_interests = true;

        listUpdateMemberInput upInput = new listUpdateMemberInput(param);
        listUpdateMember update = new listUpdateMember(upInput);
        listUpdateMemberOutput output = update.Execute();
        if (output.result)
            Response.Write("Congrats! your details has been updated");
        else
        {
            Response.Write("Sorry! it seems you already exist in our database.");
        }
    }

    private void GetList()
    {
        // Code to get the list and add it to Dropdown list
    }
    private void GetGroups()
    {
        //Code to get groups under a list and adding it to check box
    }       

}
公共部分类注册:System.Web.UI.Page
{
受保护的无效页面加载(对象发送方、事件参数e)
{
如果(!Page.IsPostBack)
{
这个.GetList();
}
}
受保护的无效btnSubscribe\u单击(对象发送者,事件参数e)
{
Dictionary dic=新字典();
List lst=新列表();
对于(int i=0;i