Send me code How do i integrate with my project
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;
}
}
Announcements
Join our list to be notified of new features and updates to our V3 API.
Sign Up