private static void GetContactsByGroupExample(EsendexCredentials credentials) { var groupService = new GroupService(credentials); try { var collection = groupService.GetGroups(_accountReference, PageIndex, PageSize); var contacts = new PagedContactCollection(); var groupId = ""; foreach (var item in collection.Groups.Where(item => item.Name == "Test group")) { groupId = item.Id.ToString(); break; } if (groupId == "") return; contacts = groupService.GetContactsFromGroup(_accountReference, groupId, 1, 15); foreach (var item in contacts.Contacts) { Console.WriteLine("\tContact Id:{0}\tNumber:{1}", item.Id, item.PhoneNumber); } } catch (WebException ex) { Console.Write(ex.Message); } }
private static void AddContactToGroup(EsendexCredentials credentials) { var groupService = new GroupService(credentials); var contactService = new ContactService(credentials); try { var guid = new Guid("{YOUR Contact GUID}"); var contact = contactService.GetContact(guid); groupService.AddContactToGroup(_accountReference, "{YOUR Group GUID}", contact); } catch (WebException ex) { Console.Write(ex.Message); } }
private static void GetGroupsExample(EsendexCredentials credentials) { var groupService = new GroupService(credentials); try { var collection = groupService.GetGroups(_accountReference, PageIndex, PageSize); foreach (var item in collection.Groups) { Console.WriteLine("\tGroup Id:{0}\tName:{1}", item.Id, item.Name); } } catch (WebException ex) { Console.Write(ex.Message); } }