通过Web应用程序的Outlook Automation创建约会 [英] Outlook Automation from a web application to create appointments

查看:93
本文介绍了通过Web应用程序的Outlook Automation创建约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用ActiveX技术从Web应用程序自动执行Outlook是否是标准做法?与Telerik的RadScheduler + telerik的Exchange Provider等Web调度程序相比,如何从Web应用程序本身调度约会呢?

Is it a standard practice to automate outlook from a web application using ActiveX technology? How does this compare with a web scheduler like telerik's RadScheduler + telerik's Exchange Provider to schedule an appointment from the web application itself?

谢谢,
森希尔

Thanks,
Sendhil

推荐答案

您将需要提供有关您要完成的工作的更多详细信息,而不仅仅是在Web应用程序中声明Outlook的自动化.我之所以这样说,是因为它实际上取决于您要执行的操作.如果您要做的只是创建约会,那么您不需要ActiveX.

You will need to provide more details about what you are trying to accomplish rather then just stating automation of outlook within a web application. The reason I say this is because it really depends on what you are trying to do. If all you are trying to do is create an appointment then no you do not need activex.

您可以在这里进行研究或调查.立即进入Outlook,创建约会.然后转到文件菜单并执行另存为",然后将约会保存到桌面上.您会注意到该文件存储为.ics文件.您实际上可以在记事本或Word中打开该文件并查看其内容.

Here is something you can research or look into. Go into outlook right now, create an appointment. Then go to the file menu and do a "Save As" and save the appointment onto your desktop. You will notice the file is stored as a .ics file. You can actually open this file in notepad or word and view the contents of it.

例如,下面是记事本中的示例:

For example here is a sample of what it looks like in notepad:


BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
CLASS:PUBLIC
CREATED:20091028T125325Z
DESCRIPTION:test\n
DTEND:20091028T133000Z
DTSTAMP:20091028T125325Z
DTSTART:20091028T130000Z
LAST-MODIFIED:20091028T125325Z
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=en-us:test
TRANSP:OPAQUE
UID:040000008200E00074C5B7101A82E008000000005062431CAC57CA01000000000000000
    0100000003E756880D89B504BBA9FF0FDC7D16F43
X-ALT-DESC;FMTTYPE=text/html:\n\n\n\n\n\n\n\n\ntest

现在考虑一下,您可以使用asp.net/asp生成约会,因为您可以访问StreamWriter和内存流.这到底是什么意思,这意味着您可以像这样生成一个文本文件,并猜测如果您生成这样的文本文件然后创建一个约会,该怎么办.这是我为日历项目编写的一个示例,我编写了一个工具来跟踪我所在公司的休假/休假请求.经理想要的功能之一是将员工请求添加到经理日历的一种方法.由于经理们始终在外表中,他们想快速浏览一下他们的外表日历,看看谁在办公室里,谁不在办公室里.当然,他们可以手动创建Outlook日历项目,但是过多的手动工作并不理想.

So now think about this, you can use asp.net / asp to generate an appointment because you have access to a StreamWriter and a memory stream. What exactly does this mean, it means you can generate a text file just like this and guess what if you generate a text file like this then you just created an appointment. Here is an example I wrote for a calendar item, I had written a tool to track vacation / time off requests for a company I work at. One of the features managers wanted was a way to add the employee request to the managers calendar. Due to managers always being inside of outlook they wanted to quickly glance at their outlook calendar and see who was in the office and who wasn't. Sure they could manually create the outlook calendar item but too much manual work was not ideal.

因此,我使用了StreamWriter和内存流来生成Outlook日历项目.

So I used a StreamWriter and a memory stream to generate an outlook calendar item.

这里是一个例子:

<%@ Page Language="vb" ContentType="text/html" ResponseEncoding="iso-8859-1" Debug="True" trace="False"%>
<%@ import Namespace="System.IO" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title></head>
<body>
<script runat="server"> 
Sub Page_Load(Sender As Object, E As EventArgs) 

 'PARAMETERS
    Dim beginDate as Date
    Dim endDate as Date  

    Dim VType as String = Request.QueryString("vtype")
        Dim h As Double = Request.QueryString("hours")

        If h = 8 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 4:00 PM"
        ElseIf h = 4 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 12:00 PM"
        ElseIf h = 1 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 8:00 AM"
        ElseIf h = 2 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 9:00 AM"
        ElseIf h = 3 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 10:00 AM"
        ElseIf h = 5 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 12:00 PM"
        ElseIf h = 6 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 1:00 PM"
        ElseIf h = 7 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 2:00 PM"
        ElseIf h = 9 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 5:00 PM"
        ElseIf h = 10 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 6:00 PM"
        ElseIf h = 11 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 7:00 PM"
        ElseIf h = 12 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 8:00 PM"
        ElseIf h = 13 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 9:00 PM"
        ElseIf h = 14 Then
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 10:00 PM"
        Else
            beginDate = Request.QueryString("vdate") & " 7:00 AM"
            endDate = Request.QueryString("vdate") & " 12:00 AM"
        End If

    Dim myLocation as String = Request.QueryString("location")
    Dim mySubject as String = Request.QueryString("subject")
    Dim myDescription as String = Request.QueryString("Description") 

    'INITIALIZATION
    Dim mStream As new MemoryStream()
    Dim writer As new StreamWriter(mStream)

    writer.AutoFlush = true 

    'HEADER
    writer.WriteLine("BEGIN:VCALENDAR")
    writer.WriteLine("PRODID:-//Flo Inc.//FloSoft//EN")
    writer.WriteLine("BEGIN:VEVENT") 

    'BODY
    writer.WriteLine("DTSTART:" & beginDate.ToUniversalTime.ToString("yyyyMMdd\THHmmss\Z") )
    writer.WriteLine("DTEND:" & endDate.ToUniversalTime.ToString("yyyyMMdd\THHmmss\Z") )
    writer.WriteLine("LOCATION:" & myLocation)
    writer.WriteLine("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & myDescription)
        writer.WriteLine("SUMMARY:" & mySubject)
        writer.WriteLine("X-MICROSOFT-CDO-BUSYSTATUS:FREE")

    'FOOTER
    writer.WriteLine("PRIORITY:5")
    writer.WriteLine("END:VEVENT")
    writer.WriteLine("END:VCALENDAR") 

    'MAKE IT DOWNLOADABLE
    Response.Clear() 'clears the current output content from the buffer
    Response.AppendHeader("Content-Disposition", "attachment; filename=Add2Calendar.vcs")
    Response.AppendHeader("Content-Length", mStream.Length.ToString())
    Response.ContentType = "application/download"
    Response.BinaryWrite(mStream.ToArray())
    Response.End() 
    End Sub
</script>
</body>
</html>

这篇关于通过Web应用程序的Outlook Automation创建约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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