0

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.

JsonStatham
  • 9,770
  • 27
  • 100
  • 181
  • Awesome username. Can you you imagine how unsecure it would be if browsers could just pass any information they liked to any local application? – Equalsk Dec 13 '17 at 12:21
  • The only thing you might be able to do is craft a URI that the OS will know to pass to Outlook. However, the `outlook://` scheme was discontinued in Office 2007 so I'm not sure it's possible any more. – DavidG Dec 13 '17 at 12:35
  • Are your clients using IE? On IE you could use ActiveX components. But I this would loose its value if they are using Edge. [Take a look at this.](https://stackoverflow.com/questions/1637077/outlook-automation-from-a-web-application-to-create-appointments) – rodrigogq Dec 13 '17 at 13:37
  • @DavidG That's not entirely true - you can register the protocol yourself on the client machine and then use it through Office 2016 at least. – NetMage Dec 13 '17 at 22:32

2 Answers2

1

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.

NetMage
  • 26,163
  • 3
  • 34
  • 55
  • Thanks, not the solution that I will be going with, but interesting none the less. – JsonStatham Dec 15 '17 at 11:10
  • What did you go with? – NetMage Dec 15 '17 at 19:27
  • I didnt phrase that properly. What i meant is i didnt end up launching the Outlook client, but instead went back to EWS and brought through all the properties and displayed the entire item in the browser using this line: Appointment appointmentDetailed = Appointment.Bind(service, appt.Id, new PropertySet(BasePropertySet.FirstClassProperties) { RequestedBodyType = BodyType.Text }); – JsonStatham Dec 18 '17 at 10:09
0

Active X will not be working for all the modern browsers like chrome, IEEdge, firefox and safari. Alternatively you can create below registry entry and anchor link/button to open the outlook calendar

below is the markup

<button id="outlookCalendarBtn" onclick="window.open('outlookwebcal:')">
   Open Outlook Calendar
</button>

Create below registry entry

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\outlookwebcal]
@="URL:Outlook Add Internet Calendar"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\outlookwebcal\shell]
@="open"

[HKEY_CLASSES_ROOT\outlookwebcal\shell\open]

[HKEY_CLASSES_ROOT\outlookwebcal\shell\open\command]
@="\"C:\\Program Files\\Microsoft Office\\root\\office16\\Outlook.exe\" /select outlook:calendar"