Click here to Skip to main content
14,154,232 members
Rate this:
 
Please Sign up or sign in to vote.
See more: , +
How to just open user's windows outlook calendar on a button click of my Asp.net web application.

What I have tried:

I tried using interop but did not get anything.
Posted
Updated 4-Aug-17 0:02am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You need to launch a protocol as a hyperlink in the web page, and then Outlook Calendar (if available on the user's machine), would launch by default to take control of the data processing request. The default URI scheme for Outlook Calendar is, outlookcal:, so you need to write the following code in the button.
window.open("outlookcal:");

Your HTML content, precisely would be,
<button id="outlookCalendarBtn" onclick="window.open('outlookcal:')">
   Open Outlook Calendar
</button>

This code requires Outlook Calendar, installation. If Outlook is not installed — or some other application controls this URI schemes are default handler, results are undefined and not certain. So, take proper countermeasures for those scenarios as well.

Javascript - Open a given URL in a new tab by clicking a button - Stack Overflow[^]
   
v2
Comments
Thomas Daniels 4-Aug-17 6:04am
   
+5!
Afzaal Ahmad Zeeshan 4-Aug-17 6:05am
   
Thank you!
IamWsk 4-Aug-17 6:42am
   
Thank you @Afzaal but it opens windows calendar not outlook calendar. How can I change my default handler for it?
Afzaal Ahmad Zeeshan 4-Aug-17 7:24am
   
You would need to check for these settings inside the Settings (Windows 10) or inside the Registry (all Windows editions, and versions). There you would be able to change this.

As I have already mentioned, this is all upto the user to manage which application he wants to open for this operations. Sometimes, other applications override this setting by themselves as well. A lot of other certain problems can also be encountered, and there is nothing that a web application can do for this.
IamWsk 4-Aug-17 7:57am
   
Yes I have checked with my windows 10 settings only windows calendar is available to select default app for OUTLOOKCAL: protocol. is there any other approach to change setting or open outlook calendar?
Afzaal Ahmad Zeeshan 4-Aug-17 7:59am
   
Indeed, and that would require you, and your users to make the change and there is nothing which we can do from a web application. Sadly, that is how web standards are designed. :-)
IamWsk 4-Aug-17 8:03am
   
My application's users will change the setting but outlook calendar is not listed when they are trying to change the protocol setting.
Karthik_Mahalingam 6-Aug-17 23:54pm
   
5
Afzaal Ahmad Zeeshan 7-Aug-17 7:10am
   
Thank you, Karthik.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Take a look at this thread: windows - Launch application from a browser - Stack Overflow[^]

A web browser can't launch another application without some sort of extension or plug-in. This is done for security reasons. Think about how many viruses, malware, or damaging actions could take place if browsers launched unknown applications.

If Outlook is installed on their computer, you can have it download a calendar file which would open up the event in their Outlook calendar and allow them to save it.
Difference between iCalendar (.ics) and the vCalendar (.vcs) - Stack Overflow[^]
   
Comments
Afzaal Ahmad Zeeshan 4-Aug-17 6:04am
   
On the other hand, you can use the Uri Scheme of the Outlook Calendar and launch it through JavaScript dynamically.

Please see Solution 2 for more on this.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Completely agree with solution 2 but it did not worked in my case.

So i created my own custom uri Scheme by creating 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"
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190518.1 | Last Updated 2 Sep 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100