How to restart Outlook.exe from within C++ plugin written for Outlook MAPI
I have my plugin for outlook written in MAPI C++.
There is one requirement wherein if user does GAL delete, I want to clear the cache of outlook for which there is a switch /CleanAutoCompleteCache which will clear the whole AutoComplete list of outlook as per Microsoft site.
Question is, when my I detect from within a code that someone has deleted GAL and I'll have to restart outlook.exe by supplying /CleanAutoCompleteCache switch, how to restart outlook.exe from within my C++ code?
Any help will be appreciated. Any other way to achieve it?
Hi @Mahesh Amarelia ，
Welcome to Q&A forum!
Considering your issue may be more related to add-in development, in order to solve it better, I added add-in development tag under your post, thanks for your understanding and hope your issue would be resolved soon.
TThanks @Jade Liang-MSFT !!!
It wouldn't be a good idea to force Outlook to close and restart without the user's knowledge or permission. Why not have your add-in advise the user that a restart is needed and let them decide whether to restart immediately or later?
Thanks @RLWA32 for the response
You are perfectly right, I did it in that way, like when restart is required, we are displaying prompt to user saying please restart outlook.
But my problem is, I have to supply one command line switch called "/CleanAutoCompleteCache" to Outlook.exe. Now when user double clicks and starts outlook.exe, how to supply it at that time? Is there a way to do it?
There are many ways that an Outlook process can be started. Maybe you could use the Image File Execution Options registry key to run your own code instead of a debugger and intercept process startup. Use a flag to add the command line switch to your own code to start the Outlook process.
Take a look at set-image-file-execution-options-will-always-open-the-named-exe-file-as-defaul
If using Image File Execution Options is too intrusive you could install a shortcut that executes Outlook with the desired command line parameters and advise the user to restart Outlook using the shortcut.
Have you decided how you're going to proceed?
Actually, I wanted to pass one switch (command line parameter) to Outlook.exe when we restart it. But the idea to restart by short cut doesn't seem feasible as we can't force user to start exe by double clicking the short cut. User may do it by any which way he/she feels easy to do it. So I dropped that idea.
Again regarding, Image File Execution Options seems to be bit unexplored thing for me and the fix I have to provide doesn't have much time to do it.
Finally I found a way to do it by outlook property. As of now working on it, if it runs, it will be easier and quicker solution.
If you decide that this solution works for you kindly share it with us. I'm not sure exactly what you mean since as far as I know Outlook/MAPI properties have nothing to do with Windows command line processing.
Sign in to comment