Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Outlook Automation (Calendar)

3 views
Skip to first unread message

Andy Trezise

unread,
Nov 26, 2003, 1:18:00 PM11/26/03
to
Hi

I am trying to include Outlook in my application...or more to the point just
the calendar / tasks part.

Do anyone have any experience of creating new appointments / tasks in
outlook. I have been able to create a new instance of outlook and summon the
NEWAPPOINTMENT method but I would like to completely automate the process
from my application and add new entries without the outlook interface.

Thanks


Trevor Hancock [MSFT]

unread,
Dec 4, 2003, 4:14:02 PM12/4/03
to
How about this?

Respectfully,
Trevor Hancock, MCSD
Microsoft Developer Support - FoxPro

This posting is provided "AS IS" with no warranties, and confers no rights.

*-----------------------------------
* AUTHOR: Trevor Hancock (Tre...@Microsoft.com)
* CREATED: 04/15/03 12:17:51 PM
* ABSTRACT: Creates an appointment with selected receptients
* via Outlook automation.
*-----------------------------------

*-- Define some Outlook constants. I found the values for these
*-- by using the Object Browser in Outlook: In Outlook, press F11
*-- to open the VB editor, then press F2 to open the Object Browser.
*-- Change library to Outlook and search away.
#DEFINE olAppointmentItem 1
#DEFINE olMeeting 1

#DEFINE olFree 0
#DEFINE olTentative 1
#DEFINE olBusy 2
#DEFINE olOutOfOffice 3

#DEFINE olRequired 1
#DEFINE olOptional 2

LOCAL loOutlook AS Outlook.APPLICATION, ;
loNS AS Outlook.Namespace, ;
loAppt AS Outlook.AppointmentItem, ;
loRecipts AS Outlook.Recipients, ;
loRecipt AS Outlook.Recipient

*-- Create Outlook and login
loOutlook=CREATEOBJECT([Outlook.Application])
loNS = loOutlook.GetNamespace([MAPI])
loNS.Logon()

*-- Create a new appointment and set it up
loAppt = loOutlook.CreateItem(olAppointmentItem)
WITH loAppt
*-- You need to set MettingStatus to be able to send the appointment.
*-- If you don't, you won't have the option.
*.MeetingStatus = olMeeting
*--
.Subject = [Test Appt]
.Body = [This is the body]
.Location = [Meeting Room 1]
.START = {^2003-12-05,04:00:00 P}
.END = {^2003-12-05,05:00:00 P}
.ReminderSet = .T.
.ReminderMinutesBeforeStart = 15
.BusyStatus = olBusy
.IsOnlineMeeting = .F.

loRecipts = .Recipients
loRecipt = loRecipts.ADD([Trevor Hancock])
loRecipt.TYPE = olRequired && olOptional is other option
loRecipts.ResolveAll()

*-- Save the appointment
.SAVE()
ENDWITH

*-- Clean up after ourselves.
loNS.Logoff()
loRecipts = NULL
loRecipt = NULL
loNS = NULL
loApt = NULL
*loOutlook.QUIT
loOutlook = NULL

Andy Trezise

unread,
Dec 8, 2003, 7:00:27 AM12/8/03
to
Thank you very much...that works a treat.

Is there anywhere I can find a full set of Methods / Properties for the
Outlook environment (particularly the calendar part)?

Things I would like to do include:

Change the default viewing properties of the calendar...day view / week /
month.
Add items to the task list.
Find all appointments between two times.
Change / store the window properties (ie the size of each section - task
list - calendar - diary).


"Trevor Hancock [MSFT]" <tre...@online.microsoft.com> wrote in message
news:X68AEuqu...@cpmsftngxa07.phx.gbl...

0 new messages