首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >恒触点-更新触点

恒触点-更新触点
EN

Stack Overflow用户
提问于 2012-11-14 22:14:38
回答 1查看 399关注 0票数 0

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

但是,我收到一条错误消息,声明:远程服务器返回了一个错误:(500)内部服务器错误.

描述:是在执行当前web请求时发生的一个未处理的异常。请查看堆栈跟踪以获得有关错误的更多信息,以及它起源于代码的位置。

异常详细信息: System.Net.WebException:远程服务器返回一个错误:(500)内部服务器错误。

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

我引用了ConstantContactBO.dllConstantContactUtility;

我似乎找不出问题,任何帮助都是非常感谢的。谢谢。

代码语言:javascript
复制
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);
        }


    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-15 20:16:58

我漏掉了以下几点:

代码语言:javascript
复制
 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);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13388327

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档