问题
I wish to execute a URL in the formatmapi://{S-1-5-21-1626573300-1364474481-487586288-1001}/toto@mycompany.com($b423dcd5)/0/Inbox/가가가가곕갘객겒갨겑곓걌게겻겨곹곒갓곅갩갤가갠가
, which I got from searching via Windows Desktop Search.
On Vista with Outlook 2007, this fails to open Emails if outlook is already open. Except sometimes, when it works for mysterious reasons.
Below are some things I've tried in an attempt to get this to work:
Executing it with Process.Start
, or executing it with Process.Start
via cmd.exe /c start. The former froze for a minute, then did nothing, with Process.Start
returning null (except when Outlook was not already open, when it worked). The latter popped up an "Unspecified Error" message box.
Open mails in outlook from java using the protocol "mapi://"
I couldn't figure out how to get this script to work. The vbs scripts I generated claimed to have found invalid characters. Also, this solution makes me sad.
http://social.msdn.microsoft.com/forums/en-US/windowsdesktopsearchdevelopment/thread/00491710-e245-452f-8b0a-56caa56277e4/
I suspect this solution will work. However, I couldn't get it working in C++ or C# due to compiler errors. This is a matter of not being sure which libraries to include or in C# how to effectively use ShellItem2
etc. with interop.
Creating application shortcut in a directory
I tried creating a shortcut and calling Process.Start
on that. This also did not work, though the shortcut itself worked when I double-clicked on it.
回答1:
Turns out the issue was a UAC issue. I tend to run VS as admin, since some apps need it.
来源:https://stackoverflow.com/questions/3946701/open-mails-in-outlook-from-c-sharp-using-the-protocol-mapi