Accessing Contact Name in New Call Dialog (Outlook TAPI Dialer)

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Hello,

When an Outlook user selects the phone icon in a Contact item, the New
Call dialog opens and the user can select the Start Call button to
place a call via TAPI using the Number shown in the dialog (or an
alternate number from the pick list). The New Call dialog also
indicates the Contact name apparently obtained from the associated
Contact item.

Is it possible to know programmatically in my Add-In that the user
selected the Start Call button, and read the Contact name?

I thought I might just read and store the Full Name when a Contact
item is accessed (Open or SelectionChange), and then retrieve that
name when my TAPI service provider code sees an outbound call request
from Outlook. (I already have IPC messaging between my Add-In and my
TAPI service provider code, so passing the data is not a problem --
getting the data is the only problem.)

But this isn't reliable because the user can open the New Call dialog
for a Contact, and then before selecting Start Call, he can open a
different Contact and then select Start Call for the first Contact.
In this case, my read and store code above would report the name from
the second Contact, which is incorrect.

I see newsgroup postings describing how to programmatically launch the
New Call dialog, but that isn't what I'm after. I am looking for an
Outlook event or some other way to know that the user opened the New
Call dialog and which Contact item is unambiguously related so I can
read the Full Name for the Contact.

Thanks.

Jim
 
There is no Outlook event that will fire when the New Call dialog opens. You
might be able to intercept when the button is executed by instantiating a
button declared WithEvents for that control. I'm not sure how you'd get the
selected contact however, other than using
ActiveExplorer.CurrentFolder.Selection.
 
Ken,

Your suggestion got me going. I've made some progress. The following
prototype code successfully sets an Office.CommandBarButton object in
my Add-In, with WithEvents, to the button of interest 'New Call...' in
the Outlook Standard CommandBar.

It turned out to be a little more complicated than I expected because
the Outlook AutoDialer button (the one with the phone icon) is of type
msoControlSplitButtonPopup. So I had to also iterate through it's
controls to get at the 'New Call...' button and hook it up to my
CommandBarButton object using WithEvents.

Private WithEvents objButtonAutoDialer As Office.CommandBarButton

:

Dim objCommandBar As Office.CommandBar
Dim objSplitButtonPopup As Office.CommandBarPopup
Dim strCaption As String
Dim i, j, k As Integer

For i = 1 To objExplorer.CommandBars.Count
Set objCommandBar = objExplorer.CommandBars.Item(i)
If objCommandBar.Name = "Standard" Then
'Found Outlook Standard CommandBar.
For j = 1 To objCommandBar.Controls.Count
strCaption = objCommandBar.Controls.Item(j).Caption
If Replace(strCaption, "&", "") = "AutoDialer" Then
'Found AutoDialer button, Type = msoControlSplitButtonPopup.
Set objSplitButtonPopup = objCommandBar.Controls.Item(j)
For k = 1 To objSplitButtonPopup.Controls.Count
strCaption = objSplitButtonPopup.Controls.Item(k).Caption
If Replace(strCaption, "&", "") = "New Call..." Then
'Found New Call button in AutoDialer popup menu.
'Set obj to button that provides _Click via WithEvents.
Set objButtonAutoDialer = _
objSplitButtonPopup.Controls.Item(k)
Set objSplitButtonPopup = Nothing
Set objCommandBar = Nothing
Exit Sub
End If
Next k
End If
Next j
End If
Next i
Set objSplitButtonPopup = Nothing
Set objCommandBar = Nothing

Using the code above, the MsgBox below opens when I select the 'New
Call...' option:

Private Sub objButtonAutoDialer_Click( _
ByVal Ctrl As Office.CommandBarButton, _
CancelDefault As Boolean)
On Error Resume Next
MsgBox "objButtonAutoDialer_Click"
End Sub

Excellent.

But there is a problem. The MsgBox opens when I select the down arrow
on the split button popup, and then select 'New Call...' from the
popup menu, but if I do not select the down arrow and just select the
default action by pressing the phone icon to the left of the down
arrow, the New Call dialog opens *without* sending an event to my
_Click event handler.

I had expected (hoped) that selecting the phone icon part of the split
button popup would behave as if 'New Call...' were selected from the
popup menu, since it results in the same execution. No joy.

I tried changing the code above to set an object with WithEvents for
the CommandBarPopup itself so I could perhaps get a _Click event for
it:

Private WithEvents objSplitButtonPopup As Office.CommandBarPopup

But that does not compile -- I get the compiler error:

Object does not source automation events

Ouch.

I am close but not quite there. I can get an event when the item of
interest is selected from the popup menu. But can I get an event when
that same item is selected as the default behavior when the non-popup
portion of the button is selected?

Thanks.

Jim
 
Can you get the ID of the built-in button you want? If so you could
instantiate your button to use the built-in button. Just declare a new
button object with that ID and you should be able to intercept the Execute
method of the original button.
 
Hello, Jim
I'm programming a Java application.
Now, I'm wanting to integrate the video conference function into the
application. I intend to launch the "place a call" dialog of
NetMeeting in the application, maybe through calling complied dll file
using com interface.
does any one have good ideas?

I look into Netmeeting SDK, but does not find any resolution.

You said you saw something newsgroup postings describing how to
programmatically launch the new call dialog. Can you tell me?

Thanks
New Call dialog

Thanks.
 
(e-mail address removed) (NorthStar) wrote in message
You said you saw something newsgroup postings describing how to
programmatically launch the new call dialog. Can you tell me?

Sorry for the delayed response, I only just checked back in this
newsgroup.

I have not programmatically launched the New Call dialog myself, so I
can't be of much help. When I was looking for a solution to my own
problem (detect when New Call is about to be launched by Outlook, and
intercept it), it seems like I saw some newsgroup postings discussing
what you are after. I regret to say that I really don't recall where
I saw those, or what search led me there.

If you find a solution, please follow up. I still plan to try Ken's
suggestion for my situation when I return to that issue in a few days.
If I get something running (not really what you are looking for) I'll
be sure to follow up with a post describing the outcome.

Regards,

Jim
 
Back
Top