I am having a few problems with lists. I have a C# application that populates lists from a database - it has been working fine up until a few weeks ago. The only thing that has changed is a new post office with a very similar name. For example, I have example.co.uk with several lists (one including members@) I then added example.ie with one list (members@). My application can no longer find the lists - I've been trying to find a solution for days and I am stuck!
Here is some code (although it was working a few weeks ago):
Clear the lists
Code: Select all
MailEnable.Administration.ListMember listMember = new MailEnable.Administration.ListMember();
listMember.AccountName = POSTOFFICE;
listMember.ListName = this.meLists[i];
int result = listMember.FindFirstListMember();
Console.WriteLine("Initial Status: " + result);//returns 0 now
while (result == 1)
{
result = listMember.RemoveListMember();
listMember = new MailEnable.Administration.ListMember();
listMember.AccountName = POSTOFFICE;
listMember.ListName = this.meLists[i];
result = listMember.FindFirstListMember();
}
Console.WriteLine("Cleared " + this.meLists[i] + " list");
Code: Select all
public int addMemberToList(String postoffice, String listName, String email)
{
if (listExists(postoffice, listName))
{
MailEnable.Administration.ListMember listMember = new MailEnable.Administration.ListMember();
listMember.AccountName = postoffice;
listMember.Address = "[SMTP:" + email + "]";
listMember.ListMemberType = 0;
listMember.ListName = listName;
listMember.Status = 1;
return listMember.AddListMember();
}
throw new Exception("List " + listName + ", PO: " + postoffice + " does not exist"); //this is getting thrown by the application
}
protected Boolean listExists(String postoffice, String listName)
{
MailEnable.Administration.List oList = new MailEnable.Administration.List();
oList.AccountName = postoffice;
oList.ListName = listName;
Boolean listExists = (oList.GetList() == 1); //this returns 0
oList = null;
return listExists;
}
If you need any more information just let me know (it's my first post), thanks in advance.