Outlook 2007: SendUsingAccount - update infobar

  • Thread starter Thread starter mark.terhofen
  • Start date Start date
M

mark.terhofen

Hello,

I´m using the SendUsingAccount-Funktion to set the mail-Account I´d
like to use for sending a new message. This works fine. The selected
account can be seen from the check when clicking on the "Account"-
Button (Below "Send")
My Problem:
The gray info-bar between the ribbonbar and the send-button. Normally
there is text like "you replied" or "the message has not yet been
sent" shown.

1) Sometimes this gray-info bar is shown, sometimes not. This depends
on composing a new Mail or replying to an old one. I always want to
have this info-bar. Is there a vba-command (or another way) to show it
always?

2) If this Info-bar is visible it says "The message will be sent using
Account xxx". When changing this account with the SendUsingAccount-
function the info-bar is not updated although the message is sent via
the choosen account. Is there a possibility to update/redraw the info-
bar?

Thanks,
Mark
 
1) No, Outlook controls the visibility of the infobar and does not expose its
visibility or content to developers.

2) I cannot reproduce your problem. If the infobar is visible and I change
the value of SendUsingAccount, the infobar refreshes about a heartbeat later
to show the new account.
 
1) No, Outlook controls the visibility of the infobar and does not expose its
visibility or content to developers.
Ok.

2) I cannot reproduce your problem. If the infobar is visible and I change
the value of SendUsingAccount, the infobar refreshes about a heartbeat later
to show the new account.

This is what I do:

Private Sub Application_Startup()
Set myInspector = Application.Inspectors
End Sub

Create New Mail

Make infobar visible by "selecting" the already selected account
number 1

run Testfunction manually:
Private Sub Test()
Application.ActiveInspector.CurrentItem.SendUsingAccount =
Application.Session.Accounts.Item(2)
End Sub

Result: info bar shows Account 1, Account-Button shows Account 2
(which is also used when sending)

What am I doing wrong?

Mark
 
1) No, Outlook controls the visibility of the infobar and does not exposeits
visibility or content to developers.
Ok.

2) I cannot reproduce your problem. If the infobar is visible and I change
the value of SendUsingAccount, the infobar refreshes about a heartbeat later
to show the new account.

I´m doing the following:

Private Sub Application_Startup()
Set myInspector = Application.Inspectors
End Sub

Create a new Mail

Make the info-bar visible by selcting the already selected Acoount 1

manually call:
Private Sub Test()
Application.ActiveInspector.CurrentItem.SendUsingAccount =
Application.Session.Accounts.Item(2)
End Sub

The text in the infobar does not change. But the account 2 is selected
and used

What am I doing wrong?

Mark
 
OK, I see the same behavior if I follow your steps. My code was making the
change when the NewInspector event fires. You might see if that works better
for you . If not, I don't know how to make Outlook do what you want.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
OK, I see the same behavior if I follow your steps. My code was making the
change when the NewInspector event fires.

Can´t reproduce this.
You might see if that works better for you.

I hope so.
I want to change the sending account automaticly when opening a
compose-new-mail-window depending on
- compose new mail --> account 3
- reply, reply all, forward --> depends on recipient of parant message
(I have different E-Mail-Alias).

You can find my source below. Do you have another suggestion which
includes changing the infobar?

Regards,
Mark


Public WithEvents myInspector As Outlook.Inspectors
Public WithEvents newMailItem As MailItem

Private Sub Application_Startup()
Set myInspector = Application.Inspectors
End Sub

Private Sub myInspector_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class = olMail Then
Set newMailItem = Inspector.CurrentItem
End If
End Sub

Private Sub newMailItem_Open(Cancel As Boolean)
If newMailItem.CreationTime = "01.01.4501" Then
'A new MailElement is created
If newMailItem.ConversationIndex <> "" Then
'Reply oder forward
'##find parent message-recipient and set correct
account_number here##
newMailItem.SendUsingAccount =
Application.Session.Accounts.Item(account_number)
Else
'new Mail
newMailItem.SendUsingAccount =
Application.Session.Accounts.Item(3)
End If
Else
'An existing MailElement is opened in read-modus
'Do nothing
End If
End Sub
 
This expression -- newMailItem.CreationTime = "01.01.4501" -- will always
return False, because CreationTime is a date/time property, not a string
property. Better to use newMailItem.Size, which will equal 0 for a new item.

As I've said before, the behavior of the infobar is not directly
controllable.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Back
Top