Community
Showing results for 
Search instead for 
Do you mean 
Reply

Find contacts not working

Tuned Listener
Posts: 23
Country: UK

Find contacts not working

I've been having problems with finding contacts. Eventually i tried to run this piece of Sanity Checking code and it seems that I have finally found the issue that is causing me hassle:

ContactList cl = _actFramework.Contacts.GetContacts(null);
MutableEntityFieldDescriptor nameField = _actFramework.GetFieldDescriptor("TBL_CONTACT.FULLNAME", true);
string Name = cl[0].FullName;
int ContactPos = cl.Find(nameField, Name);

This always returns ContacPos == -1
The list is populated and the person has a name but I can't get this code to work.

What I'm actually trying to do is create a DoesContactExist(string fullName) function.

Does anyone have any ideas?

Cheers

Russell
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Find contacts not working

Hi Russell,

 

try:

ContactList cl = _actFramework.Contacts.GetContacts(null);
ContactFieldDescriptor nameField = _actFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.FULLNAME",true);
string name = cl[0].FullName;
int contactPos = cl.Find(nameField,Name);

ContactFieldDescriptor inherits from PropertyDescriptor so that should happily work. You might need to possibly cast the ContactFieldDescriptor?

 

HTH

Vivek

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog