static void Main(string[] args) { int page = 0; Client c = new Client("*****@*****.**", "Dynam1cs!"); //try //{ // ServiceResult<ApiContactList> CallResult = c.GetAddressBookContacts(98555, true, 1000, 1000 * page); // ApiContactList finalList = CallResult.Data; // while (CallResult.Data.Count == 1000) // { // page++; // try // { // CallResult = c.GetAddressBookContacts(98555, true, 1000, 1000 * page); // finalList.AddRange(CallResult.Data); // } // catch (Exception e) // { // Console.WriteLine(e.Message); // } // } // if (CallResult.Success) // { // //ServiceResult<ApiContactList> results = c.GetAddressBookContacts(104567, true); // foreach (ApiContact ac in finalList) // { // Console.WriteLine(ac.Email); // } // } // else // { // Console.WriteLine("Error: " + CallResult.Message); // } //} //catch (Exception e) //{ // Console.WriteLine(e.Message); //} //Console.WriteLine("Finished. Pages: " + page.ToString()); AddressBookByID ads = new AddressBookByID(); ads.AddressBookID = "103662"; ads.UserName = "******"; ads.Password = "******"; ads.GetContacts(); foreach (ApiContact ac in ads.CallResult.Data) { Console.WriteLine(ac.Email); } Console.Read(); }
public bool send() { try { var client = new Client(UserName,Password); byte[] b = System.Text.Encoding.UTF8.GetBytes(importfiletext); ApiFileMedia afm = new ApiFileMedia(); afm.Data = b; afm.FileName = "contacts.csv"; CallResult = client.PostAddressBookContactsImport(AddressBookID, afm); return true; } catch (Exception e) { ErrorText = e.Message; return false; } }
public bool GetCampaigns() { try { var c = new Client(username, password); campaignsResult = c.GetCampaigns(); if (campaignsResult.Success) { campaignListResult = campaignsResult.Data; return true; } else { errorText = campaignsResult.Message; return false; } } catch (Exception e) { errorText = e.Message; return false; } }
//functions public bool GetResults() { try { var c = new Client(username, password); callResult = c.GetCampaignActivities(campaignId); if (callResult.Success) { CampaignResultContacts = callResult.Data; return true; } else { errorText = callResult.Message; return false; } } catch(Exception e) { errorText = e.Message; return false; } }