【问题标题】:Constant Contact - Update Contact持续联系 - 更新联系
【发布时间】:2012-11-16 04:16:58
【问题描述】:

我正在尝试通过使用更新列表中已存在的联系人 Utility.UpdateContactFullForm(authenticationData, contact);

但是,我收到一条错误消息,指出: 远程服务器返回错误:(500) Internal Server Error.

说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详情: System.Net.WebException:远程服务器返回错误:(500) Internal Server Error。

来源错误: 在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息。

我已经引用了 ConstantContactBO.dllConstantContactUtility;

我似乎无法找出问题所在,非常感谢任何帮助。谢谢。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ConstantContactBO;
using ConstantContactUtility;


public partial class hmm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string nextChunkId;
        Contact contact = new Contact();
        //Authentication Data
        AuthenticationData authenticationData = new AuthenticationData();
        authenticationData.Username = "";
        authenticationData.Password = "";
        authenticationData.ApiKey = "";

        // get user Contact List collection
        IList<ContactList> lists = Utility.GetUserContactListCollection(authenticationData, out nextChunkId);

        //Search for Contact By Email
        string x = "a@a.com";
        string[] emailAddress = new string[] { x.Trim() };
        IList<Contact> myList = Utility.SearchContactByEmail(authenticationData, emailAddress, out nextChunkId);

        for (int i = 0; i < myList.Count; i++)
        {
            contact.Id = myList[0].Id;
            contact.FirstName = Server.HtmlEncode("abc");
            contact.LastName = Server.HtmlEncode("def");
            contact.EmailAddress = Server.HtmlEncode("a@a.com");

            ContactOptInList theList = new ContactOptInList();
            theList.OptInSource = ContactOptSource.ActionByContact;
            theList.ContactList = new ContactList("39");
            contact.ContactLists.Add(theList);
              Utility.UpdateContactFullForm(authenticationData, contact);
        }


    }
}

【问题讨论】:

    标签: c# asp.net constantcontact


    【解决方案1】:

    我错过了以下内容:

     Contact thisContact = Utility.GetContactDetailsById(authenticationData, myContact[0].Id);
               // //Add Lists
                ContactOptInList newList = new ContactOptInList();
                //thisContact.OptInSource = ContactOptSource.ActionByCustomer;
                newList.ContactList = new ContactList("39"); //Contact list you want to add them to
                newList.ContactList = new ContactList("10"); //Contact list you want to add them to
                thisContact.ContactLists.Add(newList);
    
                //Update contact
                Utility.UpdateContactFullForm(authenticationData, thisContact);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-04
      • 2021-09-25
      相关资源
      最近更新 更多