question

MaheshAmarelia-8742 avatar image
0 Votes"
MaheshAmarelia-8742 asked RLWA32-6355 commented

How to restart Outlook.exe from within C++ plugin written for Outlook MAPI

Hi There

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?

office-outlook-itproc++office-addins-dev
· 10
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MaheshAmarelia-8742

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.

1 Vote 1 ·

TThanks @JadeLiang-MSFT !!!

0 Votes 0 ·

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?

1 Vote 1 ·

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?

0 Votes 0 ·

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


1 Vote 1 ·

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.

1 Vote 1 ·
Show more comments

0 Answers