This sample application includes only a single file, the AutoAccept script. This script, called Autoaccept.txt, is provided here. You can use it in the installation of this sample application, described in Installing the AutoAccept Agent:
<SCRIPT RunAt=Server Language=VBScript>
'THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT
'WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
'INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
'OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
'PURPOSE
'---------------------------------------------------------------------
'
' NAME: Autoaccept.Txt
'
' FILE DESCRIPTION: Auto-accept mtg request sample for Exchange Scripting Agent
'
' Copyright (c) Microsoft Corporation 1993-1997. All rights reserved.
'
'
' NOTE: This example uses the Meeting Item Object. See MAPI SDK for the
' details of the properties, constants and methods of this object.
'
' NOTE: This example also show how you might integrate Jscript with VBScript.
'
'---------------------------------------------------------------------
Option Explicit
'---------------------------------------------------------------------
' Global Variables
'---------------------------------------------------------------------
Dim g_bstrDebug 'Debug String
'---------------------------------------------------------------------
' CONSTANTS
'---------------------------------------------------------------------
Dim g_Const_CDOMeetingItem
Dim g_Const_CDOMeetingRequest
Dim g_Const_CDOMeetingResponse
Dim g_Const_CDOResponseDeclined
Dim g_Const_CDOResponseAccepted
Dim g_Const_CDOResponseTentative
Dim g_Const_CdoFree
Dim g_Const_CdoBusy
Dim g_Const_CdoTentative
Dim g_Const_CdoOutOfOffice
g_Const_CDOMeetingItem = 27
g_Const_CDOMeetingRequest = 1
g_Const_CDOMeetingResponse = 2 'Note: Not used but given for reference
g_Const_CDOResponseDeclined = 3
g_Const_CDOResponseAccepted = 4
g_Const_CDOResponseTentative = 2
g_Const_CdoBusy = "2" 'Constants for BusyFree result we show
g_Const_CdoFree = "0" 'an example for using CdoFree
g_Const_CdoOutOfOffice = "3"
g_Const_CdoTentative = "1"
'---------------------------------------------------------------------
' EVENT HANDLERS
'---------------------------------------------------------------------
' DESCRIPTION: This event is fired when a new message is added to the folder
Public Sub Folder_OnMessageCreated
Dim oStores 'Stores Object
Dim oTemp 'Temporary Object
Dim oMtg 'Meeting Object
Dim oAppt 'Appointment Object
Dim oMtgResp 'Meeting Response Object
Dim oUser 'User Object
Dim Item 'Item Object
Dim Resp 'Response integer variable
Dim Tstart 'Start Time
Dim Tend 'End Time
Dim x
Set oUser = EventDetails.Session.CurrentUser
Call DebugAppend("AUTOACCEPT - Folder_OnMessageCreated",False)
'Get Incomming Meeting Msg
Set oMtg = EventDetails.Session.GetMessage(EventDetails.MessageID, Null )
If oMtg.Class <> g_Const_CDOMeetingItem Then
Call DebugAppend("Message is not a meeting request or response.",False)
Else
'Ok, It's a meeting, but is it a request ?
If oMtg.MeetingType <> g_Const_CDOMeetingRequest then
Call DebugAppend("Meeting item is not a request",False)
Else
Set oAppt = oMtg.GetAssociatedAppointment
Resp = oUser.GetFreeBusy(oAppt.starttime, oAppt.endtime, 30)
Call DebugAppend("Free/busy times = " & Resp,False)
If Resp = g_Const_CdoFree then
Call DebugAppend("Free - Accepting meeting",False)
Set oMtgResp = oMtg.Respond(g_Const_CDOResponseAccepted)
oMtgResp.Text = "Conf room available. Meeting accepted."
Else
Call DebugAppend("Declining meeting",False)
Set oMtgResp = oMtg.Respond(g_Const_CDOResponseDeclined)
oMtgResp.Text = "Conf room unavailable for selected time. Meeting declined."
End If
oMtgResp.Send
End If
End If
Call DebugAppend("Error Detected: ",True) 'Check for any possible sys errors
Script.Response = g_bstrDebug
End Sub
' DESCRIPTION: This event is fired when a message in the folder is changed
Public Sub Message_OnChange
'Not Used
End Sub
' DESCRIPTION: This event is fired when a message is deleted from the folder
Public Sub Folder_OnMessageDeleted
'Not Used
End Sub
' DESCRIPTION: This event is fired when the timer on the folder expires
Public Sub Folder_OnTimer
'Not Used
End Sub
'-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
' PRIVATE FUNCTIONS/SUBS
'-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
'---------------------------------------------------------------------
' Name: DebugAppend
' Area: Debug
' Desc: Simple Debugging Function
' Parm: String Text, Bool ErrorFlag
'---------------------------------------------------------------------
Private Sub DebugAppend(bstrParm,boolErrChkFlag)
if boolErrChkFlag = True then
if err.number <> 0 then
g_bstrDebug = g_bstrDebug & bstrParm & "-" & cstr(err.number) & err.description & vbCrLf
err.clear
end if
else
g_bstrDebug = g_bstrDebug & bstrParm & vbCrLf
end if
End Sub
</SCRIPT>