AppointmentItem Change Event

D

David C. Holley

Is there a CHANGE event for an AppointmentItem? I have a one-way
interface between Access and Outlook and would like to complete it by
detecting if the AI being changed was created by Access.
 
D

David C. Holley

Can I assume that the entire Outlook Object Model is accessible via
VBScript? Just thought I'd ask in advance.
 
S

Sue Mosher [MVP-Outlook]

Yes. The details, of course, depend on the type of application you're writing.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
D

David C. Holley

I did a cursory investigative study of VBScript (translated I played
around a little). I'm pretty certain that I can code the procedure to
update Access via Outlook, my next question is how would I call the SUB
from VBScript? I'm assuming that the SUB would have to be in VBA to
allow full access to the Access Object Model and all that fun stuff.
 
S

Sue Mosher [MVP-Outlook]

Just like Access and other Office applications, Outlook can be automated with VBScript. An event-handler, however, needs to be in a class module, which means VBA, VB, VS.Net, Delphi etc. (An exception is custom Outlook forms, which support Outlook item-level events in VBScript code.)

What's the "big picture" goal of your application?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
D

David C. Holley

The BIG, summarized picture is that when a record is added to or
modified in my Access database, Access reaches out to Outlook and
creates an AppointmentItem. The AIs are tagged with the RecordId from
Access which is used to later find the AI. The recordId is stored in a
user defined field. All of the AIs use a custom form which displays the
information in the user defined fields. I would like to code the form to
check the field and then offer an alter that the AI is DB related and
then create the ability to send changes to the AI (Date, Time, etc.)
from Outlook to Access. The code for that aspect I can handle since I'm
quite familar with the Access Object Model. The help that I need deals
with where to place the specific modules and when to call them.
 
S

Sue Mosher [MVP-Outlook]

Thanks. That makes it much easier to explain your options. Since you're using a custom appointment form, the logical place to put the code is in that form. Forms use VBScript as their code language.

The event that fires when the item open is ... the Item.Open event. In the form's View Code window, you'll see a Script | Event Handler command that will add the declaration for any item-level event handler. If you want to send changes to the database when the user sames the appointment, you'd use the Item.Write event to run your code.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
D

David C. Holley

I have some proof of concept code in the Item_Close event. The code runs
fine when I'm in design mode for the code using RUN THIS FORM. When
PUBLISH THE FORM AS... and then open the form and close it, nothing
happens. When I design the form, the code is there.
 
S

Sue Mosher [MVP-Outlook]

Yes, VBScript in an Outlook form can call a Public Sub or Function located in the built-in ThisOutlookSession module in Outlook VBA as Application.MyProcedureName. Note, though, that this technique is unsupported.
 
S

Sue Mosher [MVP-Outlook]

There are two major causes of code in an Outlook form not running -- 1) security settings in Outlook 2002 SP3 and later 2) the broader form script security features introduced with the Outlook Email Security Update.

#1: Outlook 2002 SP3 and later versions include a new setting -- turned off by default -- to allow forms in shared mailboxes to run script. You can change the setting by choosing Tools | Options | Other | Advanced Options and checking the box for Allow script in shared folders. See http://www.outlookcode.com/d/ol2003problems.htm#mailboxscript for more information on this setting and a comparable one (on by default for public folders).

#2: If the form runs code when you use Run This Form in design mode, but doesn't run code after you have sent or saved an item using the published form, you probably have done something to "one-off" the form. Outlook 2003, Outlook 2002, Outlook 2000 SP2 and Outlook 2000 or 98 with the Email Security Update will not run code on one-off forms; see http://www.outlookcode.com/d/secforms.htm for more information on this issue.

To ensure that a form does not one-off:

-- Make sure the "Send form definition with item" box on the (Properties) tab of the form is *not* checked. [1]

-- For in-house corporate use with Exchange Server, publish the form to the Organization Forms library or a public folder's forms library, as appropriate for your application.

-- For collaboration via the Internet, publish your form to your Personal Forms library. Save it as an .oft file and send it to other people who need to use it with instructions to publish it with the same form name that you used.

Many other things can cause one-off forms. If the above steps don't work on a new item created with your form, see http://www.outlookcode.com/d/formpub.htm#oneoff for other possible causes.

[1] Whenever you publish a message form, Outlook will suggest that you may want to check the "Send form definition with item" box to ensure that the recipient will have the form, especially if you're sending to someone via the Internet. In the current Outlook security environment, this suggestion is obsolete. Ignore it unless your form has no code behind it.


--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
D

David C. Holley

Actually, in playing I selected 'NEW RESERVATIONS' from whichever menu
option the custom form was listed under. Outlook installed the form and
its been working ever since.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top