We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

I want use this in my asp.net mvc

MandiC77984
Regular Participant

I want use this in my asp.net mvc

Send me code How do i integrate with my project 

1 REPLY 1
MandiC77984
Regular Participant

Here is may code:

I have mentioned Where am i getting Error..

plz resolve my issue asap..

Or Give me new code

 

 

public void GetNewsLetterCampaign(string Email)
{
string messageResult = string.Empty;

if (string.IsNullOrWhiteSpace(Email))
{
//MessageBox.Show("Please provide an email address!", "Warning");
}
else
{

//get contact if exists (by email address)
Contact contact = null;

try
{
contact = GetContactByEmailAddress(Email.Trim());
}
catch (CtctException ctcEx)
{
//contact not found
}

bool alreadyExists = contact != null ? true : false;


Contact result = null;

var contactService = _constantContactFactory.CreateContactService();



result = contactService.AddContact(contact, false);  //Here I am facing Error
}
}

private Contact GetContactByEmailAddress(string emailAddress)
{
var contactService = _constantContactFactory.CreateContactService();
ResultSet<Contact> contacts = contactService.GetContacts(emailAddress, 1, null, null); //Here also I am facing error

if (contacts != null)
{
if (contacts.Results != null && contacts.Results.Count > 0)
{
return contacts.Results[0];
}
}

return null;
}
}

Developer Portal

View API documentation, code samples, get your API key.

Visit Page