本文整理汇总了C#中CTCT.ConstantContact类的典型用法代码示例。如果您正苦于以下问题:C# ConstantContact类的具体用法?C# ConstantContact怎么用?C# ConstantContact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConstantContact类属于CTCT命名空间,在下文中一共展示了ConstantContact类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: frmEmailCampaign_Load
private void frmEmailCampaign_Load(object sender, EventArgs e)
{
try
{
string state = "ok";
_accessToken = OAuth.AuthenticateFromWinProgram(ref state);
if (string.IsNullOrEmpty(_accessToken))
{
Application.Exit();
}
//initialize ConstantContact member
_constantContact = new ConstantContact(_apiKey, _accessToken);
}
catch (OAuth2Exception oauthEx)
{
MessageBox.Show(string.Format("Authentication failure: {0}", oauthEx.Message), "Warning");
}
PopulateCampaignTypeList();
PopulateListOfCountries();
PopulateUSAndCanadaListOfStates();
GetListOfContacts();
PopulateEmailLists();
}
示例2: LiveVerifiedEmailAddressTest
public void LiveVerifiedEmailAddressTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var list = cc.GetVerifiedEmailAddress();
Assert.IsNotNull(list);
Assert.AreNotEqual(0, list.Count);
}
示例3: LiveActivityExportContactsTest
public void LiveActivityExportContactsTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var lists = new List<string>() { "1" };
ExportContacts export = new ExportContacts();
export.Lists = lists;
Activity activity = cc.AddExportContactsActivity(export);
Assert.IsNotNull(activity);
Assert.IsNotNull(activity.Id);
Assert.AreEqual(activity.Type, "EXPORT_CONTACTS");
}
示例4: GetLibraryInfoTest
public void GetLibraryInfoTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var result = cc.GetLibraryInfo();
Assert.IsNotNull(result);
Assert.IsNotNull(result.UsageSummary);
}
示例5: LiveActivityClearListTest
public void LiveActivityClearListTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var emailAddresses = new List<string> { String.Format("{0}@example.com", Guid.NewGuid()) };
var lists = new List<string> { "2" };
var add = new AddContacts(
new List<AddContactsImportData>{
new AddContactsImportData{
EmailAddresses = emailAddresses
}
},
lists,
null
);
Activity act = cc.CreateAddContactsActivity(add);
Assert.IsNotNull(act);
Activity activity = cc.AddClearListsActivity(lists);
Assert.IsNotNull(activity);
Assert.AreEqual(activity.Type, "CLEAR_CONTACTS_FROM_LISTS");
}
示例6: LiveDeleteContactListTest
public void LiveDeleteContactListTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var contactList = new ContactList
{
Name = string.Format("List {0}", Guid.NewGuid()),
Status = Status.Active
};
var result = cc.AddList(contactList);
Assert.IsNotNull(result);
Assert.IsTrue(result.Name.Equals(contactList.Name));
result.Name = string.Format("List - {0}", Guid.NewGuid());
var deleted = cc.DeleteList(result.Id.ToString(CultureInfo.InvariantCulture));
Assert.IsTrue(deleted);
}
示例7: LiveDeleteFolderTest
public void LiveDeleteFolderTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var folder = new MyLibraryFolder();
folder.Id = Guid.NewGuid().ToString();
folder.Name = Guid.NewGuid().ToString();
folder.CreatedDate = Extensions.ToISO8601String(DateTime.Now);
folder.ModifiedDate = Extensions.ToISO8601String(DateTime.Now);
var newFolder = cc.AddLibraryFolder(folder);
bool result = cc.DeleteLibraryFolder(newFolder.Id);
Assert.IsTrue(result);
}
示例8: LiveGetContactByEmail
public void LiveGetContactByEmail()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var contact = new Contact();
contact.EmailAddresses.Add(new EmailAddress { EmailAddr = String.Format("{0}@email.com", Guid.NewGuid()), ConfirmStatus = ConfirmStatus.NoConfirmationRequired, Status = Status.Active });
contact.Lists.Add(new ContactList { Id = "1", Status = Status.Active });
Contact nc = cc.AddContact(contact, false);
Assert.IsNotNull(nc);
Assert.IsNotNull(nc.Id);
var result = cc.GetContacts(nc.EmailAddresses[0].EmailAddr, 1, DateTime.Now.AddMonths(-1));
Assert.IsNotNull(result);
Assert.IsNotNull(result.Results);
Assert.AreEqual(1, result.Results.Count);
}
示例9: LiveGetContactFromListTest
public void LiveGetContactFromListTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
IList<ContactList> lists = cc.GetLists(DateTime.Now.AddMonths(-1));
Assert.IsNotNull(lists);
Assert.AreNotEqual(0, lists.Count);
ResultSet<Contact> contacts = cc.GetContactsFromList(lists[0].Id, DateTime.Now.AddMonths(-1));
Assert.IsNotNull(contacts);
Assert.IsNotNull(contacts.Results);
contacts = cc.GetContactsFromList(lists[0].Id, 3, DateTime.Now.AddMonths(-1));
Assert.IsNotNull(contacts);
Assert.IsNotNull(contacts.Meta);
Assert.IsNotNull(contacts.Meta.Pagination);
Assert.IsNotNull(contacts.Meta.Pagination.Next);
Assert.IsNotNull(contacts.Results);
Assert.AreEqual(3, contacts.Results.Count);
contacts = cc.GetContactsFromList(DateTime.Now.AddMonths(-1), contacts.Meta.Pagination);
Assert.IsNotNull(contacts);
Assert.IsNotNull(contacts.Meta);
Assert.IsNotNull(contacts.Meta.Pagination);
Assert.IsNotNull(contacts.Meta.Pagination.Next);
Assert.IsNotNull(contacts.Results);
Assert.AreEqual(3, contacts.Results.Count);
}
示例10: LiveEmailCampaignTestSendTest
public void LiveEmailCampaignTestSendTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var camp = new EmailCampaign
{
EmailContent = "<html><body>EMAIL CONTENT.</body></html>",
Subject = "campaign subject",
FromName = "my company",
FromEmail = CustomerEmail,
ReplyToEmail = CustomerEmail,
Name = "campaign_" + DateTime.Now.ToString("yyMMddHHmmss"),
TextContent = "email campaign text content",
GreetingString = "Dear ",
//TemplateType = TemplateType.CUSTOM,
Status = CampaignStatus.DRAFT,
EmailContentFormat = CampaignEmailFormat.HTML,
StyleSheet = "",
MessageFooter = new MessageFooter
{
OrganizationName = "my organization",
AddressLine1 = "123 Mapple Street",
AddressLine2 = "Suite 1",
AddressLine3 = "",
City = "Boston",
State = "MA",
PostalCode = "02101",
Country = "US",
IncludeForwardEmail = true,
ForwardEmailLinkText = "forward link",
IncludeSubscribeLink = true,
SubscribeLinkText = "subscribe link"
}
,
Lists = new List<SentContactList> { new SentContactList { Id = "1" } }
};
camp = cc.AddCampaign(camp);
Assert.IsNotNull(camp);
Assert.IsNotNull(camp.Id);
var test = new TestSend {
Format = EmailFormat.HTML_AND_TEXT.ToString(),
PersonalMessage = "This is a test send of the email campaign message.",
EmailAddresses = new List<string> { CustomerEmail }
};
var testSend = cc.SendTest(camp.Id, test);
Assert.IsNotNull(testSend);
Assert.AreEqual(test.Format, testSend.Format);
}
示例11: LiveUpdateContactTest
public void LiveUpdateContactTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var contact = new Contact();
contact.EmailAddresses.Add(new EmailAddress { EmailAddr = String.Format("{0}@email.com", Guid.NewGuid()), ConfirmStatus = ConfirmStatus.NoConfirmationRequired, Status = Status.Active });
contact.Lists.Add(new ContactList { Id = "1", Status = Status.Active });
var nc = cc.AddContact(contact, false);
Assert.IsNotNull(nc);
Assert.IsNotNull(nc.Id);
nc.CompanyName = "some company";
var retrievedContact = cc.UpdateContact(nc, false);
Assert.IsNotNull(retrievedContact);
Assert.AreEqual(retrievedContact.Id, nc.Id);
Assert.AreEqual(retrievedContact.CompanyName, nc.CompanyName);
}
示例12: LiveCampaignTrackingGetClicksTest
public void LiveCampaignTrackingGetClicksTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var camp = CreateTestCampaign(cc);
ResultSet<ClickActivity> result = cc.GetCampaignTrackingClicks(camp.Id, "1", null, DateTime.Now.AddMonths(-1));
Assert.IsNotNull(result);
}
示例13: CreateTestCampaign
private EmailCampaign CreateTestCampaign(ConstantContact cc)
{
var camp = new EmailCampaign
{
EmailContent = "<html><body>EMAIL CONTENT.</body></html>",
Subject = "campaign subject",
FromName = "my company",
FromEmail = CustomerEmail,
ReplyToEmail = CustomerEmail,
Name = "campaign_" + DateTime.Now.ToString("yyMMddHHmmss"),
TextContent = "email campaign text content",
GreetingString = "Dear ",
Status = CampaignStatus.DRAFT,
EmailContentFormat = CampaignEmailFormat.HTML,
StyleSheet = "",
MessageFooter = new MessageFooter
{
OrganizationName = "my organization",
AddressLine1 = "123 Mapple Street",
AddressLine2 = "Suite 1",
AddressLine3 = "",
City = "Boston",
State = "MA",
PostalCode = "02101",
Country = "US",
IncludeForwardEmail = true,
ForwardEmailLinkText = "forward link",
IncludeSubscribeLink = true,
SubscribeLinkText = "subscribe link"
}
,
Lists = new List<SentContactList> { new SentContactList { Id = "1" } }
};
camp = cc.AddCampaign(camp);
Assert.IsNotNull(camp);
Assert.IsNotNull(camp.Id);
DateTime schDate = DateTime.Now.AddDays(1);
Schedule schedule = cc.AddSchedule(camp.Id, new Schedule { ScheduledDate = schDate });
Assert.IsNotNull(schedule);
Assert.AreNotEqual(0, schedule.Id);
Assert.IsNotNull(schedule.ScheduledDate);
return camp;
}
示例14: LiveGetFilesByFolderTest
public void LiveGetFilesByFolderTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var folders = cc.GetLibraryFolders();
Assert.IsNotNull(folders);
Assert.IsNotNull(folders.Results);
Assert.AreNotEqual(0, folders.Results.Count);
var files = cc.GetLibraryFilesByFolder(folders.Results[0].Id);
Assert.IsNotNull(files);
Assert.IsNotNull(files.Results);
}
示例15: LiveDeleteTrashFilesTest
public void LiveDeleteTrashFilesTest()
{
var cc = new ConstantContact(ApiKey, AccessToken);
var result = cc.DeleteLibraryTrashFiles();
Assert.IsTrue(result);
}