繁体   English   中英

Javascript:如何通过按钮将事件添加到 Outlook 日历

[英]Javascript: How to add event via button to Outlook Calendar

我目前有一个有效的 vbscript 实现:

<code>
<script language="VBScript">
    <!--
    sub MakeAppointment(MySubject, MyLocation, MyStart, MyEnd, MyMessage)
    Dim objOutlook
    Dim itmCalendar
    Set objOutlook = CreateObject("Outlook.application")
    Set itmCalendar = objOutlook.CreateItem(1)

    itmCalendar.Subject = MySubject
    itmCalendar.Location = MyLocation
    itmCalendar.Start = MyStart
    itmCalendar.End = MyEnd
    itmCalendar.Body = MyMessage

    itmCalendar.Save

    Msgbox "Appointment has been added to your Outlook Calendar!", 0, MyStart

    Set itmCalendar = Nothing
    Set objOutlook = Nothing
    end sub
    -->
</script>
<script language="VBScript">
    <!-- 
    Sub btnAdd_onclick()
    MySubject="All your base are belong to us" 
    MyLocation="Japan"
    MyStart="05/19/2011 07:00"
    MyEnd="05/19/2011 08:00"
    MyMessage = "This is a English review course." & vbcrlf
    MyMessage = MyMessage & "" & vbcrlf
    MyMessage = MyMessage & "" & vbcrlf
    MyMessage = MyMessage & "" & vbcrlf
    MakeAppointment MySubject, MyLocation, MyStart, MyEnd, MyMessage
    End Sub
    -->
</script>
</code>

我需要一些关于如何为 Javascript 重写此内容的帮助,因为我正在为其编写的另一个 SharePoint 网站使用 Javascript 作为其默认验证脚本语言。 有可能吗? 是否有指向实现此目标的可能资源的链接?

接受的答案对我没有帮助。 因此,我将发布截至 2015 年 12 月我认为有用的内容。

http://calendar.live.com/calendar/calendar.aspx?rru=addevent

参数:

dtstart ( yyyymmddThhmmss )

必需的。 指定事件的开始日期和时间。 例如,20110101T120000 表示 2011 年 1 月 1 日中午。 请注意,指定事件时间(T120000)的部分是可选的。

趋势( yyyymmddThhmmss )

必需的。 指定事件的结束日期和时间。 例如,20110101T120000 表示 2011 年 1 月 1 日中午。 请注意,指定事件时间(T120000)的部分是可选的。

摘要转义字符串

可选的。 指定事件的标题。

位置转义字符串

可选的。 指定事件的位置文本。

 <a href="http://calendar.live.com/calendar/calendar.aspx?rru=addevent&dtstart=2015-12-07T20:00:00+00:00&dtend=2015-12-07T22:00:00+00:00&summary=Weekly Planning&location=BigCoHQ">Add to Outlook</a>

来源: msdn.microsoft.com

我设法通过将事件信息直接填充到 Outlook 链接来解决这个问题,因此它会将您重定向到一个模式,您可以在将其保存到日历之前验证事件信息是否正确。

 <a href="https://outlook.live.com/owa/?path=/calendar/view/Month&rru=addevent&startdt=20200213T000000Z&enddt=20200214T000000Z&subject=Test+Event&location=Dublin">Add to Outlook Calendar</a>

以下链接示例包含您想要从对象填充信息的参数

https://outlook.live.com/owa/?path=/calendar/view/Month&rru=addevent&startdt=${eventStart}&enddt=${eventEnd}&subject=${eventName}&location=${eventLocation}&body=${事件描述}

接受的答案对我不起作用。 这是截至 2022 年 11 月仍在运行的版本:

https://outlook.live.com/calendar/0/deeplink/compose?allday=false&body=This%20is%20event%20description&enddt=2022-11-29T15%3A15%3A00%2B00%3A00&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=2022-11-29T14%3A45%3A00%2B00%3A00&subject=TestEvent

您也可以通过此链接生成它: https://www.labnol.org/calendar/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM