saving an outlook apt to a specific folder

  • Thread starter Thread starter SAC
  • Start date Start date
S

SAC

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.
 
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.
 
Thanks you very much. How would I make the appointment in a Public folder
and not the default folder.

I want it to be in the folder used as a company wide folder used with
exchange server.

Sorry I wasn't more specific before.

Thanks again.
 
Without knowing your specific directory structure it is hard to be specific,
however you can get a reference to the public folders as shown below, and
then drill down to the appropriate folder.

Set olkAppt =
olkNameSpace.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("MyPublicApptFolder")

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Thanks you very much. How would I make the appointment in a Public folder
and not the default folder.

I want it to be in the folder used as a company wide folder used with
exchange server.

Sorry I wasn't more specific before.

Thanks again.
 
Back
Top