AutoAccept - Removing body of an meetingrequest before added to calendar 
Author Message
 AutoAccept - Removing body of an meetingrequest before added to calendar

Hello

Below you can see the autoaccept script we use on meetingrooms. The
rooms
accepts meetings automatically. This functions 100%

I want to remove the Body of the request before it is added to the
calendar. (on the meetingroom only)
How can I do this?

I have tried both:
   oAppt.Body = "Body autoremoved"
and
   oMtg.Body = "Body autoremoved"

but both failes : property not valid?

It is running on Exchange 2k as Agent on mailboxes
I have not found an easy way to debug, so can anyone help ???

MartOn
IT Department at Wartsila Norway

<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 meeting request sample for
Exchange
    '                   Scripting Agent.
    ' Copyright (c) Microsoft Corporation 1993-1997. All rights
reserved.
    ' NOTE: This example uses the Meeting Item Object. Please
    '       see the MAPI SDK for the details of the properties,
constants
    '       and methods of this object.
    '---------------------------------------------------------------------'
    Option Explicit

    '---------------------------------------------------------------------'
    ' Global Variables
    '---------------------------------------------------------------------'
    Dim g_bstrDebug    'Debug String

    '---------------------------------------------------------------------'
    '    CONSTANTS
    '---------------------------------------------------------------------'
    Dim g_Const_CDOAppointmentItem
    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
    Dim g_Const_CdoNonMeeting
    Dim g_Const_CdoMeeting
    Dim g_Const_CdoMeetingCanceled
    Dim g_Const_CdoMeetingReceived

    Dim g_Const_CdoRecurTypeDaily
    Dim g_Const_CdoRecurTypeWeekly
    Dim g_Const_CdoRecurTypeMonthly
    Dim g_Const_CdoRecurTypeMonthlyNth
    Dim g_Const_CdoRecurTypeYearly
    Dim g_Const_CdoRecurTypeYearlyNth
    Dim g_Const_CdoSunday
    Dim g_Const_CdoMonday
    Dim g_Const_CdoTuesday
    Dim g_Const_CdoWednesday
    Dim g_Const_CdoThursday
    Dim g_Const_CdoFriday
    Dim g_Const_CdoSaturday

    Dim g_Const_MaxYearRecur
    Dim g_Const_MaxOtherRecur
    Dim g_Const_LastInstance

    ' Assign values to Constants.
     g_Const_CDOAppointmentItem = 26
     g_Const_CDOMeetingItem = 27
     g_Const_CDOMeetingRequest = 1
     g_Const_CDOMeetingResponse = 2 'Not used but given for reference.
     g_Const_CDOResponseDeclined = 4
     g_Const_CDOResponseAccepted = 3
     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"

     g_Const_CdoNonMeeting = 0
     g_Const_CdoMeeting = 1
     g_Const_CdoMeetingCanceled = 5
     g_Const_CdoMeetingReceived = 3

     g_Const_CdoRecurTypeDaily = 0
     g_Const_CdoRecurTypeWeekly = 1
     g_Const_CdoRecurTypeMonthly = 2
     g_Const_CdoRecurTypeMonthlyNth = 3
     g_Const_CdoRecurTypeYearly = 5
     g_Const_CdoRecurTypeYearlyNth = 6

     g_Const_CdoSunday = 1
     g_Const_CdoMonday = 2
     g_Const_CdoTuesday = 4
     g_Const_CdoWednesday = 8
     g_Const_CdoThursday = 16
     g_Const_CdoFriday = 32
     g_Const_CdoSaturday = 64

     g_Const_LastInstance = 5

     'Max number of months to check for conflicts on
     'yearly recurrence.
     g_Const_MaxYearRecur = 48

     'Max number of months to check for conflicts on
     'daily/weekly/monthly recurrence.
     g_Const_MaxOtherRecur = 12

    '-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-'
    '                        EVENT HANDLERS
    '-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-'
    '---------------------------------------------------------------------'
    '   Name: Folder_OnMessageCreated
    '   Description: This event fires when a new message is added
    '                to the folder.
    '---------------------------------------------------------------------'

     Public Sub Folder_OnMessageCreated

        On Error Resume Next
        Dim oStores         'Stores Object.
        Dim oMtg            'Meeting Object.
        Dim oAppt           'Appointment Object.
        Dim oMtgResp        'Meeting Response Object.
        Dim oUser           'User Object.

        Dim Resp            'Response integer variable.
        Dim sConflicts      'String description of recurring
appointment
                            'conflict.

        Set oUser = EventDetails.Session.CurrentUser

        Call DebugAppend("AUTOACCEPT - Folder_OnMessageCreated",False)

        'Get Incoming Meeting Message.
        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: " & _
                oMtg.Class,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
              ' For Schedule+ 1.0 Cancellations, the associated
appointment
              ' does not exist, so we must check the type of the
meeting
              ' request.
              If (oMtg.Type = "IPM.Schedule.Meeting.Canceled") And _
                 (oMtg.Sender.Type = "MS") Then
                 Call
DeleteOriginalAppt(oMtg.Fields(&H00620003).Value, _
                      EventDetails.Session.GetDefaultFolder(0))
                 oMtg.Delete
              Else

                 On Error Resume Next
                 Set oAppt = oMtg.GetAssociatedAppointment

                 If Err.Number = 0 Then  ' GetAssociatedAppointment OK

                    If oAppt.MeetingStatus =
g_Const_CdoMeetingReceived Then

                       'We only need to delete the associated
appointment
                       'and the original appointment (if this is an
update)
                       'if this request is from Schedule+ 1.0.
                       If oMtg.Sender.Type = "MS" Then
                          oAppt.Delete
                          Call DeleteOriginalAppt( _
                                   oMtg.Fields(&H00620003).Value, _

EventDetails.Session.GetDefaultFolder(0))
                       End If

                       If IsFree(oUser, oAppt, _

EventDetails.Session.GetDefaultFolder(0), _
                              sConflicts) Then

                          Call DebugAppend("Free - Accepting
meeting",False)

                          Set oMtgResp = _

oMtg.Respond(g_Const_CDOResponseAccepted)

                          Set oAppt =
oMtgResp.GetAssociatedAppointment
                          oAppt.ReplyTime = Now()
                          oAppt.Fields.Add &H00620003, _
                                        oMtg.Fields(&H00620003).Value
                          oAppt.Update
                          Set oAppt = Nothing

                          oMtgResp.Text = _
                           "Conference room is available. Meeting
accepted."

                       Else

                          Set oMtgResp = _

oMtg.Respond(g_Const_CDOResponseDeclined)

                          ' Set text of response message.
                          If oAppt.IsRecurring Then

                         oMtgResp.Text = "Conference room is
unavailable " _
                                  & "for all instances of your
recurring " _
                                  & "meeting request. The first
conflict " _
                                   & "found was on " & sConflicts & ".
" _
                                   & " Meeting declined. "

                        Call DebugAppend("Conflict found on " &
sConflicts _
                                   & " - Declining meeting", False)

                         Else

                         oMtgResp.Text = "Conference room is
unavailable " _
                               & "for the requested time. Meeting
declined."

                             Call DebugAppend( _
                                "Conflict found - Declining meeting",
False)

                          End If

                          Set oAppt = Nothing

                       End If

                       If oMtg.Sender.Type = "MS" Then

                          'Copy PR_OWNER_APPT_ID so that the response
is
                          'registered when received by Schedule+ 1.0.
                          oMtgResp.Fields(&H00620003).Value = _
                                   oMtg.Fields(&H00620003).Value

                          'Copy PR_SENT_REPRESENTING... properties to
                          'PR_RCVD_REPRESENTING properties to prevent
                          '"You are not this person's assistant".
                          oMtgResp.Fields.Add &H00430102, _
                                   oMtg.Fields(&H00410102).Value
                          oMtgResp.Fields.Add &H0044001E, _
                                   oMtg.Fields(&H0042001E).Value

                       End If

                       oMtgResp.Send
...

read more »



Mon, 01 Aug 2005 20:35:55 GMT  
 AutoAccept - Removing body of an meetingrequest before added to calendar
Autoaccept scripts work with CDO messages, not OOM. Try the Text property.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool


Quote:
> Hello

> Below you can see the autoaccept script we use on meetingrooms. The
> rooms
> accepts meetings automatically. This functions 100%

> I want to remove the Body of the request before it is added to the
> calendar. (on the meetingroom only)
> How can I do this?

> I have tried both:
>    oAppt.Body = "Body autoremoved"
> and
>    oMtg.Body = "Body autoremoved"

> but both failes : property not valid?

> It is running on Exchange 2k as Agent on mailboxes
> I have not found an easy way to debug, so can anyone help ???

> MartOn
> IT Department at Wartsila Norway

> <SCRIPT RunAt=Server Language=VBScript>

'---------------------------------------------------------------------'
Quote:
>     '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

'---------------------------------------------------------------------'
Quote:
>     ' NAME: Autoaccept.Txt
>     ' FILE DESCRIPTION: Auto-accept meeting request sample for
> Exchange
>     '                   Scripting Agent.
>     ' Copyright (c) Microsoft Corporation 1993-1997. All rights
> reserved.
>     ' NOTE: This example uses the Meeting Item Object. Please
>     '       see the MAPI SDK for the details of the properties,
> constants
>     '       and methods of this object.

'---------------------------------------------------------------------'
Quote:
>     Option Explicit

'---------------------------------------------------------------------'
Quote:
>     ' Global Variables

'---------------------------------------------------------------------'
Quote:
>     Dim g_bstrDebug    'Debug String

'---------------------------------------------------------------------'
Quote:
>     '    CONSTANTS

'---------------------------------------------------------------------'

- Show quoted text -

Quote:
>     Dim g_Const_CDOAppointmentItem
>     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
>     Dim g_Const_CdoNonMeeting
>     Dim g_Const_CdoMeeting
>     Dim g_Const_CdoMeetingCanceled
>     Dim g_Const_CdoMeetingReceived

>     Dim g_Const_CdoRecurTypeDaily
>     Dim g_Const_CdoRecurTypeWeekly
>     Dim g_Const_CdoRecurTypeMonthly
>     Dim g_Const_CdoRecurTypeMonthlyNth
>     Dim g_Const_CdoRecurTypeYearly
>     Dim g_Const_CdoRecurTypeYearlyNth
>     Dim g_Const_CdoSunday
>     Dim g_Const_CdoMonday
>     Dim g_Const_CdoTuesday
>     Dim g_Const_CdoWednesday
>     Dim g_Const_CdoThursday
>     Dim g_Const_CdoFriday
>     Dim g_Const_CdoSaturday

>     Dim g_Const_MaxYearRecur
>     Dim g_Const_MaxOtherRecur
>     Dim g_Const_LastInstance

>     ' Assign values to Constants.
>      g_Const_CDOAppointmentItem = 26
>      g_Const_CDOMeetingItem = 27
>      g_Const_CDOMeetingRequest = 1
>      g_Const_CDOMeetingResponse = 2 'Not used but given for reference.
>      g_Const_CDOResponseDeclined = 4
>      g_Const_CDOResponseAccepted = 3
>      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"

>      g_Const_CdoNonMeeting = 0
>      g_Const_CdoMeeting = 1
>      g_Const_CdoMeetingCanceled = 5
>      g_Const_CdoMeetingReceived = 3

>      g_Const_CdoRecurTypeDaily = 0
>      g_Const_CdoRecurTypeWeekly = 1
>      g_Const_CdoRecurTypeMonthly = 2
>      g_Const_CdoRecurTypeMonthlyNth = 3
>      g_Const_CdoRecurTypeYearly = 5
>      g_Const_CdoRecurTypeYearlyNth = 6

>      g_Const_CdoSunday = 1
>      g_Const_CdoMonday = 2
>      g_Const_CdoTuesday = 4
>      g_Const_CdoWednesday = 8
>      g_Const_CdoThursday = 16
>      g_Const_CdoFriday = 32
>      g_Const_CdoSaturday = 64

>      g_Const_LastInstance = 5

>      'Max number of months to check for conflicts on
>      'yearly recurrence.
>      g_Const_MaxYearRecur = 48

>      'Max number of months to check for conflicts on
>      'daily/weekly/monthly recurrence.
>      g_Const_MaxOtherRecur = 12

'-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-'
Quote:
>     '                        EVENT HANDLERS

'-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-'
'---------------------------------------------------------------------'
Quote:
>     '   Name: Folder_OnMessageCreated
>     '   Description: This event fires when a new message is added
>     '                to the folder.

'---------------------------------------------------------------------'

- Show quoted text -

Quote:

>      Public Sub Folder_OnMessageCreated

>         On Error Resume Next
>         Dim oStores         'Stores Object.
>         Dim oMtg            'Meeting Object.
>         Dim oAppt           'Appointment Object.
>         Dim oMtgResp        'Meeting Response Object.
>         Dim oUser           'User Object.

>         Dim Resp            'Response integer variable.
>         Dim sConflicts      'String description of recurring
> appointment
>                             'conflict.

>         Set oUser = EventDetails.Session.CurrentUser

>         Call DebugAppend("AUTOACCEPT - Folder_OnMessageCreated",False)

>         'Get Incoming Meeting Message.
>         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: " & _
>                 oMtg.Class,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
>               ' For Schedule+ 1.0 Cancellations, the associated
> appointment
>               ' does not exist, so we must check the type of the
> meeting
>               ' request.
>               If (oMtg.Type = "IPM.Schedule.Meeting.Canceled") And _
>                  (oMtg.Sender.Type = "MS") Then
>                  Call
> DeleteOriginalAppt(oMtg.Fields(&H00620003).Value, _
>                       EventDetails.Session.GetDefaultFolder(0))
>                  oMtg.Delete
>               Else

>                  On Error Resume Next
>                  Set oAppt = oMtg.GetAssociatedAppointment

>                  If Err.Number = 0 Then  ' GetAssociatedAppointment OK

>                     If oAppt.MeetingStatus =
> g_Const_CdoMeetingReceived Then

>                        'We only need to delete the associated
> appointment
>                        'and the original appointment (if this is an
> update)
>                        'if this request is from Schedule+ 1.0.
>                        If oMtg.Sender.Type = "MS" Then
>                           oAppt.Delete
>                           Call DeleteOriginalAppt( _
>                                    oMtg.Fields(&H00620003).Value, _

> EventDetails.Session.GetDefaultFolder(0))
>                        End If

>                        If IsFree(oUser, oAppt, _

> EventDetails.Session.GetDefaultFolder(0), _
>                               sConflicts) Then

>                           Call DebugAppend("Free - Accepting
> meeting",False)

>                           Set oMtgResp = _

> oMtg.Respond(g_Const_CDOResponseAccepted)

>                           Set oAppt =
> oMtgResp.GetAssociatedAppointment
>                           oAppt.ReplyTime = Now()
>                           oAppt.Fields.Add &H00620003, _
>                                         oMtg.Fields(&H00620003).Value
>                           oAppt.Update
>                           Set oAppt = Nothing

>                           oMtgResp.Text = _
>                            "Conference room is available. Meeting
> accepted."

>                        Else

>                           Set oMtgResp = _

> oMtg.Respond(g_Const_CDOResponseDeclined)

>                           ' Set text of response message.
>                           If oAppt.IsRecurring Then

>                          oMtgResp.Text = "Conference room is
> unavailable " _
>                                   & "for all instances of your
> recurring " _
>                                   & "meeting request. The first
> conflict " _
>                                    & "found was on " & sConflicts & ".
> " _
>                                    & " Meeting declined. "

>                         Call DebugAppend("Conflict found on " &
> sConflicts _
>                                    & " - Declining meeting", False)

>                          Else

>                          oMtgResp.Text = "Conference room is
> unavailable " _
>                                & "for the requested time. Meeting
> declined."

>                              Call DebugAppend( _
>                                 "Conflict found - Declining meeting",
> False)

>                           End If

>                           Set oAppt = Nothing

>                        End If

>                        If oMtg.Sender.Type = "MS" Then

>                           'Copy PR_OWNER_APPT_ID so that the response
> is
>                           'registered when received by Schedule+ 1.0.
>                           oMtgResp.Fields(&H00620003).Value = _

...

read more »



Wed, 03 Aug 2005 06:42:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Adding to and removing from the Body of Message form

2. Removing entries from Add/Remove list in control panel

3. Adding your prog to add/remove

4. How do I remove a specific appointment from calendar using VBScript

5. change MeetingRequest.Organizer?

6. Send meetingrequest to Outlook from code

7. how to add text into the body text

8. HTLM/Mailto: and adding a linefeed in the body

9. Add POST data to http body before response.redirect

10. Autoaccept Task Request in Outlook 2000

11. autoaccept script

12. autoaccept script error

 

 
Powered by phpBB® Forum Software