none
Set focus in Outlook mailitem.To field using c#? RRS feed

  • Question

  • how to i set/change a cursor focus in outlook mailitem.To or Mailitem.Subject field using C#.

    I already done to create a Addin using Outlook 2010 Addin C#

    .Now i have an issue to setfocus in newmailitem To,CC,subject Field.

    How can i setfocus for this field?

    thanks Sanju

    Monday, April 28, 2014 5:29 AM

Answers

  • Hello Sanju, There is no trivial way for setting focus into particular fields of the Outlook inspector. The Outlook object model doesn't provide any property or method for this. However, you can try to use Windoes API functions or Accessibility API (as Dmitry suggested).
    Monday, April 28, 2014 6:03 AM

All replies

  • I can only think of the accessibility API.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, April 28, 2014 5:48 AM
  • Hello Sanju, There is no trivial way for setting focus into particular fields of the Outlook inspector. The Outlook object model doesn't provide any property or method for this. However, you can try to use Windoes API functions or Accessibility API (as Dmitry suggested).
    Monday, April 28, 2014 6:03 AM
  • Thanks Eugene.

    Can u suggest Any examples or samples for Windows API or Accessibility API?

    Monday, April 28, 2014 6:15 AM
  • Hi Sanju,

    There is no ready-made sample project.

    Windows API provides the following functions you may find helpful:

    1. FindWindowEx - retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window. This function does not perform a case-sensitive search.  

    2. SetFocus - sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue. 

    You can read about accessibility in the following sections in MSDN:

    Monday, April 28, 2014 7:06 AM