One alternative is to get a reference to the folder and then use the Add
method of the Items collection for that folder. For example:
Function SetAppointment()
Dim olkApp As New Outlook.Application
Dim olkAppt As Outlook.mapiFolder
Dim olkNameSpace As Outlook.Namespace
Dim appt As Outlook.AppointmentItem
On Error GoTo Errorhandler
Set olkNameSpace = olkApp.GetNamespace("MAPI")
Set olkAppt = olkNameSpace.GetDefaultFolder(olFolderCalendar)
Set appt = olkAppt.Items.Add(olAppointmentItem)
appt.Start = #10/31/2005 5:30:00 PM#
appt.Subject = "Trick or Treat"
appt.Location = "Neighborhood"
appt.BusyStatus = olOutOfOffice
appt.Duration = 120
appt.Body = "Pickup up costume."
appt.Save
Function_Exit:
Set appt = Nothing
Set olkAppt = Nothing
Set olkNameSpace = Nothing
Set olkApp = Nothing
Exit Function
Errorhandler:
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, "Error"
Resume Function_Exit
End If
End Function
--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
I'd like to make an Outlook Apt item and save it to a specific folder.
What's the syntax for saving it to a specific folder?
Thanks.