Community
Showing results for 
Search instead for 
Do you mean 
Reply

Toolbar button - how to get email address of contact?

Accepted Solution Solved
New Member
Posts: 6
Country: USA
Accepted Solution

Toolbar button - how to get email address of contact?

I have been struggling to get much useful information out of the SDK documentation but thanks to somed decent contributions by members of this forum, I have been able to make some good progress with creating a plugin to add a toolbar button.

 

What I am trying to do is get the email address of the current contact from a button in the "contact detail toolbar". From the database table structure document I can see that the email address is stored in the table TBL_EMAIL, in a field called "ADDRESS".

 

But how does one actually return that email address in C#?

 

I have tried the following block of code but get an error from Act saying that it doesn't exist:

 

Act.Framework.Contacts.ContactFieldDescriptor ocEmailZ = ActApplication.ActFramework.Contacts.GetContactFieldDescriptor("TBL_EMAIL.ADDRESS");
object oEmailZ = ocEmailZ.GetValue(oCurrentContact);
MessageBox.Show("Email: " + oEmailZ.ToString());

 Would be really grateful for some help!


Accepted Solutions
Solution
Accepted by topic author martinc
‎09-25-2015 03:20 AM
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Toolbar button - how to get email address of contact?

Hiya,

 

Try this:

 

Act.Framework.Contacts.ContactFieldDescriptor ocEmailZ = ActApplication.ActFramework.Contacts.GetContactFieldDescriptor("E-MAIL",FieldNameType.Alias);

You need to access the dat via the Contact's table. Generally I prefer to use the Alias name rather than the "real name" as you have done for the Email Table.

 

HTH

 

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

View solution in original post


All Replies
Solution
Accepted by topic author martinc
‎09-25-2015 03:20 AM
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Toolbar button - how to get email address of contact?

Hiya,

 

Try this:

 

Act.Framework.Contacts.ContactFieldDescriptor ocEmailZ = ActApplication.ActFramework.Contacts.GetContactFieldDescriptor("E-MAIL",FieldNameType.Alias);

You need to access the dat via the Contact's table. Generally I prefer to use the Alias name rather than the "real name" as you have done for the Email Table.

 

HTH

 

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
New Member
Posts: 6
Country: USA

Re: Toolbar button - how to get email address of contact?

Superb, thanks!!!

 

Final bit of code for anyone else who needs it:

 

Act.Framework.Contacts.ContactFieldDescriptor ocEmailZ = ActApplication.ActFramework.Contacts.GetContactFieldDescriptor("E-MAIL", Act.Framework.MutableEntities.FieldNameType.Alias);
object oEmailZ = ocEmailZ.GetValue(oCurrentContact);

MessageBox.Show("Email Address: " + oEmailZ.ToString());