VSTO Outlook addIn prompt user to enter pin for encrypted emails RRS feed

  • Question

  • I have created an outlook add in loops email and reads emails body, for encrypted emails am using the IPM.Note.SMIME to check if the email is encrypted.

    what I need is how to get the pop up window so user enter the pin  and the add-in reads email body.

    Tuesday, April 26, 2016 10:02 AM


  • Hi,

    Based on the description, did you want to set the text in the window which prompt by the Outlook in the add-in?

    If I understood correctly, there is no such Outlook object model we can achieve the goal. However, it is able to do it using the Windows API.

    For example, we can get the handler of the popup window then get the textbox control by loop the child window. Then we can using sendmessage to set the text for the textbox.

    Here is an sample that create a new thread to automate enter the text into the textbox:

            public static extern Int32 SendMessage(IntPtr hWnd, int Msg, int wParam, [MarshalAs(UnmanagedType.LPStr)] string lParam);
     new Thread(()=> {
                    while (true)
                        //set text
                        SendMessage(txtboxHandler, 0x000C, 0, "Enter text here!");
                        //close window
                        SendMessage(windHandler, 0x0010, 0, "");

    If you have problem developing with the Windows API, you can try to reopen a new thread in Windows Desktop SDK forum.

    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 27, 2016 2:59 AM