How to create an appointment item in a non-default calendar

  • Thread starter Thread starter Jennifer
  • Start date Start date
J

Jennifer

Hello,

I am having a problem creating a appointment item on the shared office
calendar that sits on an exchange server.

olFolder = olFolder.Folders.GetLast(); // returns the correct path to the
folder an the calendar: Public Folders\\All Public Folders\\SR Office
Calendar

Microsoft.Office.Interop.Outlook.AppointmentItem newAppointment;

newAppointment = (Outlook.AppointmentItem)olFolder.Items; ******Here is
where it falis. What should go here?



Thank you,

Jenn
 
Firstly, do not assume that the correct folder will be returned by
Folders.GetLast. Add a new folder and see it fail. Use Folders.Item("The
folder name")
Secondly, change the line

newAppointment = (Outlook.AppointmentItem)olFolder.Items;

to

newAppointment =
(Outlook.AppointmentItem)olFolder.Items.Add("IPM.Appointment");

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
I have tried to use Folders.Item("The folder name") but I get an error that
Interop.Outlook.MAPIFolder or Interop.Outlook.Folders do not have a
definition for "Item". What am I missing?
 
Folders object certainly has a method named Item. It is a default method, so
you should be able to code it as

Folders("The folder name")


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
How do you get the "the folder name" from a shared calendar with Folder.Item, if the name isn't known before hand? That is my problem, I don't know the name of the currently focused folder if accessing shared calendars on an exchange server.

--

Thanks,
Dennis
Firstly, do not assume that the correct folder will be returned by
Folders.GetLast. Add a new folder and see it fail. Use Folders.Item("The
folder name")
Secondly, change the line

newAppointment = (Outlook.AppointmentItem)olFolder.Items;

to

newAppointment =
(Outlook.AppointmentItem)olFolder.Items.Add("IPM.Appointment");

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