none
How do I retrieve the Text on the "To" line RRS feed

  • Question

  • I use a Win32 call to retrieve the text from the To line of an email.  I retrieve the text and make sure it's valid email and check the domains.  I need to do this sometimes because when a user clicks on my Add-in button the Recipients object is not always updated.


    The problem I'm having is when I read the "To" line with names that have already been validated.  Those names get an underline.  My code will not retrieve that information.  All that comes back are the ';'s that separate the email addresses.

    Any ideas on how to get the text once it's been underlined?


    I'm using a combination of the two functions below (of course I need to call FindWindow a few times before I can get to the right one).

    hWndFound = Win32.FindWindowEx(hWnndToLine, IntPtr.Zero, "RichEdit20WPT", null);

     iCount = (int)Win32.SendMessage(hWndFound, WM_GETTEXT, (IntPtr)sb.Capacity, sb);

    NOTE: The RichText forms of these calls didn't work for me either.



    • Edited by GermanEZI Thursday, August 10, 2017 5:05 PM
    Thursday, August 10, 2017 3:18 PM

Answers

  • Hello German,

    >  I need to do this sometimes because when a user clicks on my Add-in button the Recipients object is not always updated.

    You need to call the Save method of the MailItem object before accessing the Recipients collection.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Marked as answer by GermanEZI Monday, August 14, 2017 8:30 PM
    Friday, August 11, 2017 1:49 PM

All replies

  • Hello German,

    >  I need to do this sometimes because when a user clicks on my Add-in button the Recipients object is not always updated.

    You need to call the Save method of the MailItem object before accessing the Recipients collection.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Marked as answer by GermanEZI Monday, August 14, 2017 8:30 PM
    Friday, August 11, 2017 1:49 PM
  • Thanks again Eugene.  I'm inclined to think yours may be the better of two solutions.

    I was about to go through the Accessibility API.    I'm using the Inspector.exe.

    I used to use this tool quite a few years ago, and couldn't remember it's name.  Luckily another developer did.

    The good thing about using the Tool is that I now know where the Text is stored.

    It turned out to be the text of a Button control.


    • Edited by GermanEZI Monday, August 14, 2017 8:30 PM grammar
    Monday, August 14, 2017 8:29 PM