Master email marketing fundamentals. Join the Ready, Set, Send Challenge Week 3!

I want use this in my asp.net mvc

MandiC77984
Campaign Collaborator
0 Votes

Send me code How do i integrate with my project 

1 REPLY 1
MandiC77984
Campaign Collaborator
0 Votes

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;
}
}

Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up