Adobe ColdFusion 8

cfexchangecalendar

描述

创建、删除、修改、取得和回应Microsoft Exchange日历事件,取得日历事件附件。

 

语法

create 
<cfexchangecalendar
    required 
    action = "create"
    event = "#event information structure#"
    optional 
    connection = "connection ID"
    result = "variable for event UID">

delete 
<cfexchangecalendar
    required 
    action = "delete"
    uid = "event UID,event UID, ..."
    optional 
    connection = "connection ID"
    message = "string"
    notify = "yes|no">

deleteAttachments 
<cfexchangecalendar
    required 
    action = "deleteAttachments"
    uid = "event UID"
    optional 
    connection = "connection ID">

get 
<cfexchangecalendar
    required 
    action = "get"
    name = "query identifier"
    optional 
    connection = "connection ID">

getAttachments 
<cfexchangecalendar
    required 
    action = "getAttachments"
    name = "query identifier"
    uid = "event UID"
    optional 
    attachmentPath = "directory path"
    connection = "connection ID">
    generateUniqueFilenames = "no|yes"

modify
<cfexchangecalendar
    required 
    action = "modify"
    event = "#event information structure#"
    uid = "event UID"
    optional 
    connection = "connection ID">

respond
<cfexchangecalendar
    required 
    action = "respond"
    responseType = "accept|decline|tentative"
    uid = "event UID"
    optional 
    connection = "connection ID"
    message = "string">
    notify = "yes|no">

 

注意:对于所有的运行来说,如果没有指定连接属性,你需要查看使用的cfexchangeconnection的附加属性。如果你忽略了连接属性,你就必须在cfexchangecalendar标签里指定的cfexchangeconnection标签属性来创建一个临时连接。更多细节,请看 cfexchangeconnectionopen action.

 

注意:

注意:你可以在属性选择框里面制定这个标签的属性,这个属性选择框本身是一个结构。在属性选择框里面指定属性的名字,并且使用标签的属性名作为结构的关键字。

 

属性

属性

Action

必选/可选

Default

描述

action

N/A

必选

 

取得的运行动作,必须是以下的值之一:

  • create 创建
  • delete 删除
  • deleteAttachments
  • get 取得
  • getAttachments
  • modify 修改
  • respond 回应

attachmentPath

getAttachments

可选

 

放置附件的文件路径所在目录。如果目录不存在,ColdFusion就会创建一个。

注意:如果你忽略了这个属性,ColdFusion 就不会创建任何附件。如果你指定了一个相对路径,那路径根就是ColdFusion的临时目录,该临时目录是用GetTempDirectory功能返回的。

connection

所有

可选

 

Exchange server的连接名字,指定在cfexchangeconnection标签里。

如果你忽略了这个属性,你就必须在cfexchangecalendar标签里指定cfexchangeconnection标签的属性来创建一个临时的连接。

event

创建

修改

必选

 

包含了要被设置或者改变的事件性能和值的结构的参考。你必须在#符号中指定该属性 。

For more information on the event structure, see Usage.更多事件结构的信息,请看使用方法。

generateUnique
Filenames

getAttachments

可选

no

一个Boolean值,能够在多个附件有相同的文件名的时候,指明是否需要产生独特的文件名。如果两个或者更多的附件有同样的文件名,那么选择就是yes,ColdFusionA附录了一个数字给任何有冲突文件名的文件名body (在扩展之前)。因此,如果有三个附件,有名字 myfile.txt,ColdFusion就会把附件保存为myfile.txt, myfile1.txt, and myfile2.txt.

message

删除

回应

可选

 

把可选信息发送在在回应或者删除的通告中。

name

get

getAttachments

必选

 

包含了回收的事件或者关于回收的附件的信息的ColdFusion query 变量的信息。更多关于返回数据的信息,请看使用方法。

notify

delete

respond

可选

true

指定是否通知事件变动的Boolean值。

responseType

respond

必选

 

必须是以下的值之一:

  • accept 接受
  • decline 下降
  • tentative 暂定

result

创建

可选

 

(You use the UID value in the uid attribute of actions other than create to identify the event to be acted on.)包含了创建了的UID 的事件的变量名。你可以在actions 的uid属性里使用这个UID值,这样就不用去创建确定相应运行的事件了。

uid

删除

getAttachments

修改

回应

必选

 

Case-sensitive Exchange UID value or values that uniquely identify the event or events on which to perform the action.大小写敏感的 UID值,或者单独指定事件或运行这个操作的事件 的值。

For the delete action, this attribute can be a comma-delimited list of UID values. 关于删除的动作,这个属性可以作为一个用逗号分隔的UID值清单。

(The deleteAttachments, getAttachments, modify, and respond actions allow only a single UID value. ) deleteAttachments,、getAttachments、修改和回应的动作都只允许一个单独的UID值。

使用方法

cfexchangecalendar标签在Exchange服务器上控制日历事件。使用cfexchangecalendar 可以做以下运行:

  • 创建一个任命或者会议事件。你可以创建全天的事件。
  • 删除一个或者多个事件。
  • (Get one or more events that conform to an optional set of filter specifications, such as the subject, sender or recipient ID, time received, and so on. )取得一个或者多个符合可选的过滤规格的事件,比如说subject, sender 或者recipient ID, time received等等。
  • Get the attachments for a specific event.为一个指定的事件取得附件。
  • 修改一个现存的事件。
  • 回应一个事件。

使用这个标签,你必须连接上一个 Exchange 服务器。如果你正在使用多个标签与 Exchange 服务器互动,比如说你正在创建一些联系记录,你可以使用cfexchangeconnection标签来创建一个永久连接。然后在每一个cfexchangecalendar标签里指定连接标识符,或是 在任意的其他ColdFusion Exchange 标签里指定。(如果你也存取任务, contacts, 或是 mail.) 这样做,为每一个标签 消除了间接的创建,关闭了连接。(Doing this eliminates the overhead of creating and closing the connection for each tag. )

反过来说,你可以创建一个临时的连接,这个连接只持续在ColdFusion 运行单个cfexchangecalendar标签的时候。(lasts only for the time that ColdFusion processes the single cfexchangecalendar tag. )这样做的话,就在cfexchangecontact标签里直接指定了连接属性。更多连接属性的信息,请看 cfexchangeconnection  标签。

注意:创建一个Exchange日历任命,必须要创建一个日历事件而且不要指定任何的请求或是可选的 attendees。

The create action创建

当你指定了创建的动作的时候,该事件属性必须包含了一个确认了事件信息的结构。这个结构可以有以下内容:

元素

默认

描述

AllDayEvent

no

一个显示了是否是一个全天事件的Boolean值。

Attachments

 

一个或者多个文件的路径,以附件来发送。隔开的文件路径在Windows上用到分号,在UNIX上用到冒号,并且附件的路径必须是绝对路径。

If you specify one or more attachments for a modify action, the specified attachments are added to any existing attachments; the pre-existing attachments are not deleted.如果你给一个修改的动作指定了一个或是多个附件,这个指定的附件就会被添加给任何存在的附件,这个预先存在的附件不会被删除。

Duration

 

The duration of the event in minutes.事件的期限以分钟计算。

EndTime

 

The end time of the event, in any valid ColdFusion date-time format.事件的结束时间,在任何有效期内的ColdFusiondate-time format

Importance

normal

下列值之一:

  • high
  • normal 一般
  • low. 低

IsRecurring

 

一个Boolean值用来显示该事件是否重复。如果是的话,你必须指定一个RecurrenceType 元素和其他元素来指定这个复发细节。更多信息,请看下一个表格。

Location

 

一个指定了事件地点的字符串。

Message

 

包含了事件信息的字符串,该字符串包含了HTML格式化。

OptionalAttendees

 

用逗号分隔的mail ID的清单。

Organizer

 

指定了会议组织者的字符串

Reminder

 

在事件开始运作前几分钟,开始提示的时间。

RequiredAttendees

 

A comma-delimited list of mail IDs.用逗号分隔的mail ID的清单。

Resources

 

A comma-delimited list of mail IDs for Exchange scheduling resources用逗号分隔的mail ID的清单,用来调度资源,比如说会议室和展示设备。

Sensitivity

 

The valid values are normal, company-confidential, personal, and private.有效值是normal,公司机密,个人和保密的。

StartTime

 

The start time of the event, in any valid ColdFusion date-time format.事件的开始运行时间,在任意有效的ColdFusion date-time format.

If you specify a date and time in this attribute and specify a YEARLY RecurrenceType with no other recurrence attributes, the event recurs yearly at the day and time specified in this attribute.如果你在这个属性里指定了一个日期和时间,而且没有用其他复发属性指定 YEARLY RecurrenceType,那么在这个属性里,该事件就会在每年的同一日期和时间复发。

Subject

 

描述事件主题的一个字符串

下面的表格罗列了如果设置IsRecurring field 为yes的时候,你用来指定事件复发的元素。如何指定事件复发的细节,请看 ColdFusion Developer's Guide"Specifying Calendar recurrence"

元素

类型

默认

描述

RecurrenceType

所有

每日

只用在structure有一个 yesIsRecurring元素的时候。必须是下面的值的类型:

  • 每日
  • 每周
  • 每月
  • 每年

RecurrenceNoEndDate

所有

yes

Boolean 值,如果是 yes, 事件就会复发直到你改变或者删除了事件。不能和RecurrenceCountRecurrenceEndDate一起使用。

RecurrenceCount

所有

 

事件复发的次数。不能和 RecurrenceEndDateRecurrenceNoEndDate一起使用。

RecurrenceEndDate

所有

 

最后一次复发的日期。不能和 RecurrenceCountRecurrenceEndDate一起使用。

RecurrenceFrequency

每日,每周,每月

1

根据类型,事件在一天,一周,或一月内内复发的频率。举个例子,如果是按日复发,3 schedules的复发率就是指每三天复发一次。( For example, for DAILY recurrence, a RecurrenceFrequency of 3 schedules the event every three days.)

RecurEveryWeekDay

每日

 

事件复发在每周一次,但是不是星期六或者星期天。不能和RecurrenceFrequency一起使用。(The recurrence of the event on every week day, but not on Saturday or Sunday. )

RecurrenceDays

每周

 

事件复发的那天或者一周的几天。在一个逗号分隔的列表中必须是一个或者更多以下的值(The day or days of the week on which the event occurs. Must be one or more of the following values in a comma-delimited list:)

MON, TUE, WED, THU, FRI, SAT, SUN

如果你忽略了一个每周复发的这个范围,事件复发的这个日期就要根据指定开始的日期。(If you omit this field for a weekly recurrence, the event recurs on the day of the week that corresponds to the specified start date.)

RecurrenceDay

每月,每年

 

一周内的这一天事件复发。必须是以下的其中一个值:

  • MON
  • TUE
  • WED
  • THU
  • FRI
  • SAT
  • SUN

RecurrenceWeek

每月,每年

 

事件复发的某年或者某月的这一周。

有效值是:

  • first
  • second
  • third
  • fourth
  • last

RecurrenceMonth

每年

 

事件复发的一年中的这个月。有效值必须是 JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, and DEC.

The delete action删除的动作

当你指定了删除了动作,你就必须指定一个uid 属性,该属性带有一个用逗号隔开的清单,清单里是一个或者更多的指定了删除的事件的Exchange UID。使用这个取得的动作,可以用一个 带有适当的过滤设置的表达式,来定义UID 值去指定。(Use the get action, with an appropriate filter expression, to determine the UID values to specify.)

如果所有你指定的UID都是无效的,cfexchangecalendar 标签就会产生一个错误。如果至少一个UID 是有效的,这个标签就会忽略所有无效的 UID并通过有效UID删除指定的项目。

The get action取得的动作

当你指定了取得的动作,可以使用child cfexchangefilter 标签来指定取得的信息。更多过滤器的信息,请看 cfexchangefilter

当这个标签完成运行之后,该 query 对象就会通过包含了每一个retrieved信息的name属性来指定。每一个记录都有如下的栏目:

AllDayEvent

Duration

EndTime

From

HasAttachment

HtmlMessage

Importance

IsRecurring

Location

Message

OptionalAttendees

Organizer

Reminder

RequiredAttendees

Resources

Sensitivity

StartTime

Subject

UID

 

下面的表格描述了 From, HtmlMessage, Message, 和 UID fields.。关于其他 field的更多细节,请看创建动作的描述清单。

栏目

描述

From

创建了事件的用户的Exchange ID

HtmlMessage

一个关于事件的HTML格式版本的信息

Message

一个关于事件的纯文字格式版本的信息。

UID

mail事件的Exchange 独特标识。使用该值在 delete, getAttachments, 和 modify 动作中确定事件。(The Exchange unique identifier for the mail event. Use this value to identify the event in the delete, getAttachments, and modify actions.)

The getAttachments action

当你使用 getAttachments action用的时候,你必须指定一个单独的 UID 和一个名字属性。cfexchangecalendar标签填充了一个带有指定名字的 query 对象。每一个记录都有下面的关于一个用UID之能够的事件的属性信息。(. Each record has the following information about an attachment to the event specified by the UID:)

栏目

描述

attachmentFileName

附件的文件名

attachmentFilePath

服务器上附件文件的绝对路径。如果你忽略了这个attachmentPath 属性,这个栏目就包含了空的字符串。

CID

附件的 content-ID 。特别是用来在HTMLT img 标签里插入信息里的图像的。(typically used in HTML img tags to embed images in a message.)

mimeType

附件的MIME类型,比如 text/html

isMessage

指定了附件是否是一个信息的一个Boolean值。

size

附件的大小字节。

这个标签把目录放置在附件里,该目录是用attachmentPath属性来指定的。如果你忽略了 attachmentPath 属性,ColdFusion就不会取得任何的附件,它取得是附件的信息。它让你能够定义事件的属性,而不会导致取得附件文件的架空。(without incurring the overhead of getting the attachment files.)

The modify action修改的动作

当你指定了修改的动作的时候,你可以通过指定一个带有单个事件UID的uid属性选择事件来修改;多个UID是不允许的。你只能用改变中的fields来填充事件结构。更多fields的细节描述和他们的有效值,请看创建多的清单。

如果一个事件有附件,当你修改事件的时候指定了附件,新的附件就会被添加到预先的附件里。他们不会置换他们。你必须使用 deleteAttachments action 来删除任何的附件。

The respond action回应动作

你可以使用cfexchangemail标签来做一个回应的动作,回应收到的会议通知。一个会议不会出现在你的日历里,也不能用cfexchangecalendar标签来浏览,直到你回应了mail信息并接受或者暂定接受请求的时候才可以浏览。

当你要做一个回应的动作,你必须从通知的mail信息,指定你要回应的事件的 UID。你同时还要指定回应的类型;那就是,是否你接受,驳回,或者暂定接受这个事件。你可以选择性地指定一个信息来包含回应,还可以设置一个flag 是否通知你回应的事件的创建者。( You can optionally specify a message to include in the response and set a flag whether to notify the creator of the event of your response. )

更多使用回应动作的细节信息,请看ColdFusion Developer's Guide"Working with meeting notices and requests"

范例

下面的例子让你创建,然后修改了一个日历事件。当你第一次提交 form的时候, ColdFusion 创建了日历事件,重新显示了带有你登陆的数据的 form。你应该在你修改form和重新提交之前接受事件。当你第二次提交form 的时候, ColdFusion会 发送修改的信息。更多内容,请看 ColdFusion Developer's Guide.的 "Working with meetings and appointments"

这个例子重新发送了所有的事件数据(为限制例子的长度),但是你可以改写这个例子这样的话它就只发送修改过的数据了。(This example resends all the event data (to limit the example length), but you could change the example so that it only sends modified data.)

<!--- Create a structure to hold the event information. --->
<!--- A self-submitting form for the event information --->
<!--- This example omits recurrence to keep the code relatively simple --->
<cfparam name="form.eventID" default="0">

<!--- If the form was submitted, populate the event structure from it. --->
<cfif isDefined("Form.Submit")>
        <cfscript>
        sEvent.AllDayEvent="no";
        sEvent=StructNew();
        sEvent.Subject=Form.subject;
        if (IsDefined("Form.allDay")) {
            sEvent.AllDayEvent="yes";
            sEvent.StartTime=createDateTime(Year(Form.date), Month(Form.date),
                Day(Form.date), 8, 0, 0);
        }
        else {
            sEvent.StartTime=createDateTime(Year(Form.date), Month(Form.date),
                Day(Form.date), Hour(Form.startTime), Minute(Form.startTime), 0);
            sEvent.EndTime=createDateTime(Year(Form.date), Month(Form.date),
                Day(Form.date), Hour(Form.endTime), Minute(Form.endTime), 0);
        }
        sEvent.Location=Form.location;
        sEvent.RequiredAttendees=Form.requiredAttendees;
        sEvent.OptionalAttendees=Form.optionalAttendees;
        //sEvent.Resources=Form.resources;
        if (Form.reminder NEQ "") {
            sEvent.Reminder=Form.reminder;
        }
        else {
            sEvent.Reminder=0;
        }
        sEvent.Importance=Form.importance;
        sEvent.Sensitivity=Form.sensitivity;
        sEvent.message=Form.Message;
    </cfscript>
    
    <!--- If this is the first time the form is being submitted 
            Create a new event. --->
    <cfif form.eventID EQ 0>
    <!--- Create the event in Exchange --->
        <cfexchangecalendar action="create" 
            username ="#user1#"
            password="#password1#"
            server="#exchangeServerIP#"
            event="#sEvent#"
            result="theUID">
        <!--- Output the UID of the new event. --->    
        <cfif isDefined("theUID")>        
            <cfoutput>Event Added. UID is#theUID#</cfoutput>
            <cfset Form.eventID = theUID >
        </cfif>
    <cfelse>         
    <!--- The form is being resubmitted with new data, so update the event. --->    
        <cfexchangecalendar action="modify" 
            username ="#user1#"
            password="#password1#"
            server="#exchangeServerIP#"
            event="#sEvent#"
            uid="#Form.eventID#">
        <cfoutput>Event ID #Form.eventID# Updated.</cfoutput>

    </cfif>
</cfif>

<cfform format="xml" preservedata="yes" style="width:500" height="600">
    <cfinput type="text" label="Subject" name="subject" style="width:435"><br />
    <cfinput type="checkbox" label="All Day Event" name="allDay">
    <cfinput type="datefield" label="Date" name="date" validate="date" style="width:100">
    <cfinput type="text" label="Start Time" name="startTime" validate="time"
        style="width:100">
    <cfinput type="text" label="End Time" name="endTime" validate="time"
        style="width:100"><br />
    <cfinput type="text" label="Location" name="location" style="width:435"><br />
    <cfinput type="text" label="Required Attendees" name="requiredAttendees"
        style="width:435"><br />
    <cfinput type="text" label="Optional Attendees" name="optionalAttendees"
        style="width:435"><br />
    <cfinput type="text" label="Resources" name="resources" style="width:435"><br />
    <cfinput type="text" label="Reminder (minutes)" validate="integer" name="reminder"
        style="width:200">
    <cfselect name="importance" label="Importance" style="width:100">
        <option value="normal">Normal</option>
        <option value="high">High</option>
        <option value="low">Low</option>
    </cfselect> 
    <cfselect name="sensitivity" label="Sensitivity" style="width:100">
        <option value="normal">Normal</option>
        <option value="company-confidential">Confidential</option>
        <option value="personal">Personal</option>
        <option value="private">Private</option>
    </cfselect> 
    <cfinput type="textarea" label="Message" name="message" style="width:435;
        height:100">
    <cfinput type="hidden" name="eventID" value="#Form.EventID#">
    <cfinput type="Submit" name="submit" value="Submit">
</cfform>