Search code examples
c#outlookexchangewebservicesasp.net-core-2.0

Launch Outlook from web application and open specific calendar entry


I have a requirement to display a user's calendar entries for the next month on a web application dashboard view.

I have successfully used Exchange Web Services to achieve this following this documentation:

https://msdn.microsoft.com/en-us/library/office/dn495614(v=exchg.150).aspx

The final requirements for this task are that if the user clicks on the entry (in their browser):

Outlook should open on their machine and take them straight to the actual calendar entry.

I've inspected the appointment objects and I can see I have access to the calendar Id and I can easily pass this to the server however from here I'm a little confused how I can launch the application that is on their machine and tell it to open that entry Id.

Would this be another EWS call or Office.Interop.Outlook, is it even possible at all?

If this makes it anymore difficult, this is a .Net Core 2.0 web application.


Solution

  • Outlook still accepts command line switches, one of which let's you open an Outlook item, /select.

    Now you just need to create a URL to launch Outlook with your command line arguments.

    For IE, this is not too difficult assuming your web application is trusted:

    javascript:(new ActiveXObject('Shell.Application')).ShellExecute('outlook.exe','/select outlook:<entryid>');
    

    For Chrome, you could send a cmd file or create a helper exe that is downloaded, but the user would have to manually pick open to launch it.