如何在我的ASP.NET Web应用程序的单击按钮上打开用户的Windows Outlook日历。 [英] How to just open user's windows outlook calendar on a button click of my ASP.NET web application.

查看:89
本文介绍了如何在我的ASP.NET Web应用程序的单击按钮上打开用户的Windows Outlook日历。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何只需点击我的Asp.net网络应用程序即可打开用户的Windows Outlook日历。



我尝试过:



我尝试使用互操作但没有得到任何东西。

解决方案

你需要启动一个协议作为网页中的超链接,然后Outlook日历(如果在用户的计算机上可用)将默认启动以控制数据处理请求。 Outlook日历的默认URI方案是 outlookcal:,因此您需要在按钮中编写以下代码。

  window  .open( < span class =code-string> outlookcal:); 



您的HTML内容,恰好是,

< pre lang =HTML> < 按钮 id = outlookCalendarBtn < span class =code-attribute> onclick = window.open('outlookcal:') >
打开Outlook日历
< / button >



此代码需要Outlook日历,安装。如果未安装Outlook - 或某些其他应用程序控件,此URI方案是默认处理程序,则结果未定义且不确定。因此,也要针对这些情况采取适当的对策。



Javascript - 通过单击按钮在新选项卡中打开给定的URL - Stack Overflow [ ^ ]


看一下这个帖子: windows - 从浏览器启动应用程序 - Stack Overflow [ ^ ]



如果没有某种扩展或插件,Web浏览器无法启动其他应用程序。这是出于安全原因。想想如果浏览器启动了未知的应用程序,可能会发生多少病毒,恶意软件或破坏性操作。



如果在他们的计算机上安装了Outlook,你可以下载一个日历文件,它将在Outlook日历中打开事件并允许它们保存。

iCalendar(.ics)和vCalendar(.vcs)之间的差异 - 堆栈溢出 [ ^ ]


完全同意解决方案2但它在我的情况下没有用。



所以我创建了自己的自定义uri Scheme,创建了以下注册表项



 Windows注册表编辑器版本5.00 

[HKEY_CLASSES_ROOT \outlookwebcal]
@ =URL:Outlook添加Internet日历
URL协议=

[HKEY_CLASSES_ROOT\outlookwebcal\shell]
@ =open

[HKEY_CLASSES_ROOT\outlookwebcal\shell\open]

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


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.

解决方案

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[^]


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[^]


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"


这篇关于如何在我的ASP.NET Web应用程序的单击按钮上打开用户的Windows Outlook日历。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆