Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Calendar 1

Status
Not open for further replies.

rdavis

Programmer
Apr 29, 2002
157
US
I know how to create an appointment item in the Calendar, but it is placing the item in the default Calendar. How do I place that item in a Calendar that has been created.

Thanks Rob
 
You should be able to refer to it by name such as
<appobject and parent folders>.folders.item(&quot;FolderName&quot;)
where FolderName is the name of the folder you are trying to access.
hope this helps,
sdraper
 
sdraper,

Thanks for replying, I found that out, but when I write a new appointment item, it still goes to the default calendar. In the interim, I write the entry to the default calendar, then use the move property to move the item to the 'other' calendar. It seems to work now, but if there is another solution, I would love to know.

Thanks Rob
 
Set appOutLook = GetOutlook()
Set myNameSpace = appOutLook.GetNamespace(&quot;MAPI&quot;)
Set myFolder = myNameSpace.Folders(&quot;Test&quot;)
Set calFolder = myFolder.Folders(&quot;Calendar2&quot;)
Set calOutLook = appOutLook.CreateItem(olAppointmentItem)

With calOutLook
.ReminderSet = False
.Body = &quot;Body&quot;
.Start = StartDateTime
.Duration = 0
.Importance = olImportanceHigh
.Subject = &quot;Subject&quot;
.Save
.Move calFolder
End With

This is what I have now, and it is working.

Thanks Rob
 
try changing the following line
Set calOutLook = appOutLook.CreateItem(olAppointmentItem)
to this
Set calOutLook = CalFolder.CreateItem(olAppointmentItem)
I think that will fix it. Even though you create a reference to Calendar2 when you create the appointmentitem you are referencing the application object which thinks you want to create in the default calendar folder. Give it a try!
hope this helps,
sdraper
 
sdraper,

CreateItem is not a valid property for calFolder

Rob
 
I am sorry my bad.
calFolder.Items.add(olAppointmentItem)
I got too excited when I found your solution and I spoke err typed too soon!
sdraper
 
No problem, we are allowed to get excited every now an then. The good news, that worked great. I overlooked the add property. I'm still learning interfacing with Outlook, this will help in the future. Thanks alot

Rob
 
Glad to help. If you want a book, try &quot;Outlook 2000 VBA&quot; by Dwayne Gifford isbn 1-861002-53-x
I picked it up on Ebay for about 10 bucks!
Also is an awesome resource for all things Outlook and Exchange.
the Outlook Object model is a powerfull tool enjoy!!
sdraper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top