none
Restart outlook from add-in project

    Question

  • Hi

    Is it possible to restart the outlook from a outlook add in project. My aim is In my addin project there is form called "settings". After user set the settings and click "ok button" on the settings form, need to close the form and restart the outlook.

    Now I'm using this code

    this._outlookRef.OutlookApp.Quit();
                        foreach (Process process in Process.GetProcessesByName("Outlook"))
                        {
                            process.Kill();
                        }
                        Process.Start("OUTLOOK.EXE");

    The problem is outlook is closing but not restarting. Is there any other way.

    Thanks

    Bobbin


    Friday, February 22, 2013 12:39 PM

Answers

  • yes, exactly my point - it is not up to you to decide when outlook should restart. Just inform user that he should restart outlook in order to see changes.
    Friday, February 22, 2013 1:46 PM
  • Not possible. An addin also can't disconnect or connect itself.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Bobbin Paulose" <=?utf-8?B?Qm9iYmluIFBhdWxvc2U=?=> wrote in message news:410b9939-3abb-4a7d-831b-112e902e18ea...

    Hi

    Is it possible to restart the outlook from a outlook add in project. My aim is In my addin project there is form called "settings". After user set the settings and click "ok button" on the settings form, need to close the form and restart the outlook.

    Now I'm using this code

    this._outlookRef.OutlookApp.Quit();
                        foreach (Process process in Process.GetProcessesByName("Outlook"))
                        {
                            process.Kill();
                        }
                        Process.Start("OUTLOOK.EXE");

    The problem is outlook is closing but not restarting. Is there any other way.

    Thanks

    Bobbin



    Ken Slovak MVP - Outlook
    Friday, February 22, 2013 3:52 PM
    Moderator
  • Hi,

    Thanks for all replies. 

    I applied a bat file, to restart the outlook. I don't know its a good method, but its worked for me. I done like this, When user click on "ok button" I create a bat file and in that bat file I'm handling the closing and opening of Outlook. I'm using the  below code in .bat file.

    @echo off
    For /F "Tokens=1" %%I In ('tasklist /FI "IMAGENAME eq OUTLOOK.EXE"') Do If /I "%%I"=="OUTLOOK.EXE" taskkill /f /im outlook.exe
    Start Outlook.exe

    Thanks

    Bobbin Paulose

    Wednesday, February 27, 2013 10:13 AM

All replies

  • Maybe try to take example from outlook itself - for example when you change cached mode on mailbox, it simply presents you with popup saying that changes will take effect after restarting outlook. Do not close outlook for user - he may have unsaved data in opened mails.
    Friday, February 22, 2013 1:04 PM
  • Hi Damian

    I didnt find any code to restart the outlook.

    Friday, February 22, 2013 1:18 PM
  • yes, exactly my point - it is not up to you to decide when outlook should restart. Just inform user that he should restart outlook in order to see changes.
    Friday, February 22, 2013 1:46 PM
  • Not possible. An addin also can't disconnect or connect itself.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Bobbin Paulose" <=?utf-8?B?Qm9iYmluIFBhdWxvc2U=?=> wrote in message news:410b9939-3abb-4a7d-831b-112e902e18ea...

    Hi

    Is it possible to restart the outlook from a outlook add in project. My aim is In my addin project there is form called "settings". After user set the settings and click "ok button" on the settings form, need to close the form and restart the outlook.

    Now I'm using this code

    this._outlookRef.OutlookApp.Quit();
                        foreach (Process process in Process.GetProcessesByName("Outlook"))
                        {
                            process.Kill();
                        }
                        Process.Start("OUTLOOK.EXE");

    The problem is outlook is closing but not restarting. Is there any other way.

    Thanks

    Bobbin



    Ken Slovak MVP - Outlook
    Friday, February 22, 2013 3:52 PM
    Moderator
  • Hi,

    Thanks for all replies. 

    I applied a bat file, to restart the outlook. I don't know its a good method, but its worked for me. I done like this, When user click on "ok button" I create a bat file and in that bat file I'm handling the closing and opening of Outlook. I'm using the  below code in .bat file.

    @echo off
    For /F "Tokens=1" %%I In ('tasklist /FI "IMAGENAME eq OUTLOOK.EXE"') Do If /I "%%I"=="OUTLOOK.EXE" taskkill /f /im outlook.exe
    Start Outlook.exe

    Thanks

    Bobbin Paulose

    Wednesday, February 27, 2013 10:13 AM