none
Autocomplete registered when add-in is enabled is not saved. RRS feed

  • Question

  • I am developing an add-in for Outlook 2016.
    Autocomplete registered when add-in is active will only be retained until Outlook exits.
    Even if Outlook is restarted after disabling the add-in while outlook is running, AutoComplete will not be saved.

    I am copying and processing MailItems at ItemSend event. Is there a problem with manipulating objects used within this event?
    I want to know the cause and solution of this problem.
    Wednesday, April 5, 2017 1:33 AM

All replies

  • Is it possible that your addin causes Outlook to crash before it has a chance to save the autocomplete list?

    Try to disable your addin from File | Options | Addins, then exit Outlook and check if autocomplete is saved.


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

    Wednesday, April 5, 2017 1:42 AM
  • Autocomplete registered when disabling add-in has been saved. The new autocomplete is valid even after restarting outlook.

    As far as viewing the add-in's debug log on Visual Studio 2015, Outlook ends with code 0. There is no log that Outlook also crashed in the event log.
    • Edited by giro011 Wednesday, April 5, 2017 2:29 AM
    Wednesday, April 5, 2017 2:06 AM
  • Hello,

    According to your description, Autocomplete doesn't work only when your add-in is load. So to check what code cause the issue, you may comment your code snippets one by one. Or create a new application test these code snippets.

    If you could narrow down the issue does cause from ItemSend event handler, what code do you use in that event?


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 6, 2017 6:05 AM
    Moderator
  • Autocomplete worked correctly if you commented all the code in the ItemSend event. Autocomplete did not work properly if "cancel = true" was described. However, we can not exclude this. Is there a way to solve it?

    So far I have found only this, but there may be other problematic code inside the function

    Saturday, April 8, 2017 4:53 AM
  • I test the following simple code and the autocomplete list would be saved, so please share your code here and we could try to reproduce your issue and find the cause and solution.

            private void Application_ItemSend(object Item, ref bool Cancel)
            {
                Cancel = true;
                if (Item is Outlook.MailItem)
                {
                    Outlook.MailItem mailItem = Item as Outlook.MailItem;
                    System.Diagnostics.Debug.Write(mailItem.Subject);
                }
                Cancel = false;
            }

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 10, 2017 8:08 AM
    Moderator
  • It is a code based on the response of the thread of the link below.

    https://social.msdn.microsoft.com/Forums/en-US/a7bfde0f-df72-4b12-83a0-46346f6cd592/original-mail-left-on-outbox?forum=outlookdev

    Since the original mail item has been deleted, inserting "cancel = false" displayed a warning at the time of execution, and autocomplete was not saved.

    Monday, April 10, 2017 9:58 AM
  • Hello,

    I could reproduce your issue and I find the cause. We could not use mailItem/MailItem as the name.

    Dim MailItem As MailItem = myFolder.Items(1)
            mailItem.Delete()
    


    Please change its name and the issue would be fixed.

       Dim delItem As MailItem = myFolder.Items(1)
            delItem.Delete()

    If it doesn't work for you, please let me know.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 11, 2017 9:03 AM
    Moderator
  • I am not using MailItem as a variable name. Since it has become a considerably large code, I presented the previous thread as a rough explanation of the function.In the code of the previous thread certainly adding "cancel = False" did not display a warning dialog box. However, autocomplete was not saved.

    (I think that the warning dialog box is displayed in my code because I deleted the original mail from Deleted Items Folder.)

    As far as I see behaviors in Outlook that does not contain my add-in, this is a specification of Outlook and I am beginning to think that it can not be controlled with add-ins...
    1. Open a new mail window in Outlook without using add-ins.
    2. Write a mail address that is not in the address book.
    3. Click the Check Names button. (Added to autocomplete here)
    4. Close the window and discard the mail.
    5. Restart Outlook.
    6. Open a new mail window in Outlook without using add-ins.
    7. Even if you input the first few letters of the mail address used in 2, the autocomplete did not appear.
    Tuesday, April 11, 2017 9:43 AM
  • Hello,

    I suggest you test the following code and check if the issue persists.

    If the following code works for you, I think you need to comment out your other code line by line to narrow down the issue.

            Cancel = True
            Dim toTemplate As MailItem = item.Copy
            Dim toSend As MailItem = item.Copy
            toTemplate.SaveAs("D:\test.oft", OlSaveAsType.olTemplate)
            toSend.Send()
            Me.Application.ActiveInspector.Close(OlInspectorClose.olDiscard)
            Dim myNamespace As [NameSpace] = Application.GetNamespace("MAPI")
            Dim myFolder As Folder = myNamespace.GetDefaultFolder(OlDefaultFolders.olFolderOutbox)
            Dim delItem As MailItem = myFolder.Items(1)
            delItem.Delete()
            Cancel = False

    Besides, there is no warning dialog box displayed whether I add line "cancel = False" or not.

    I suggest you create a new addin and test the code snippet.

    >>As far as I see behaviors in Outlook that does not contain my add-in, this is a specification of Outlook and I am beginning to think that it can not be controlled with add-ins

    If the issue exists without any add-in loaded, I suggest you post on Outlook IT Pro Discussions forum to get support for product issue.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 11, 2017 10:10 AM
    Moderator