I need to get focus on the already opened mail form in Outlook 2003 using C#
As per my requirement when a user opens a new Email form in Outlook and clicks send, it validates some stuff. Now if val开发者_如何学编程idation failed then it should display a message box with Yes No buttons.
Now on click of the Yes button, i need to get the focus on the already opened Mail form so that user can edit the changes and again can resend it.
I am unable to get the focus of the Mail Form. Please help me regarding the same. All the coding is done using .Net(C#)
regards, Rajeevin
Use the Activate() method on the inspector.
To get the reference to the inspector, it depends on what you already have in your validation method:
- If you have a reference to the MailItem object opened, user the GetInspector property and cast it to an Outlook.Inspector.
- If you have nothing, try to use the ActiveInspector() method on the OutlookApp object.
精彩评论