Community
Showing results for 
Search instead for 
Do you mean 
Reply

Delete multiple contacts using CONTACTID

Copper Contributor
Posts: 61
Country: United_Kingdom

Delete multiple contacts using CONTACTID

HI,

 

I've got a ListBox holding a list of CONTACTID's and I want to be able to go through that list and delete them all.

 

I know I should be using foreach but not sure how to identify and delete the contacts.

 

foreach (string s in cLookup.Items)
{

}

 Any advice greatly appreciated.

 

Thanks,

 

 

SS

Copper Contributor
Posts: 32
Country: United_Kingdom

Re: Delete multiple contacts using CONTACTID

I haven't got time to test this at the moment but this should give you the general idea. I assume you know the basics of Act Plugins, etc.

List<GUID> guidlist = new List<GUID>();
foreach (string s in cLookup.Items)
{
guidlist.add(New GUID(s));
}
GUID[] guidarray = guidlist.toArray(); //you need an array of GUID's to retrieve contacts buy

contactlist contactstodelete = application.ActFramework.Contacts.GetContactsById(Null, guidarray);

foreach(Contact cont in contactstodelete)
{
application.ActFramework.Contacts.DeleteContact(cont);}


Copper Contributor
Posts: 61
Country: United_Kingdom

Re: Delete multiple contacts using CONTACTID

Thanks very much.

 

I think the bit I was struggling with was the List<guid> to guidarrany.

 

Now that I've seen this I should be able to complete what I was trying to do.

 

Thanks again,

 

 

SS