PDA

View Full Version : Create appointments into windows live calendar using outlook vba



vlammetje
03-25-2011, 11:56 AM
I want to create an appointment into my windows live mail from within outlook.
At this moment I've got a script working which creates an appointment in the Calendar called "Calendar" within the calendar group "My Calendars".
But I want the appointment to go into the windows live calendar which I've put in an other calendar group called "Vlaming".

I've got the following script (not completed but it does create an appointment within the "Calendar"):
Sub NewAppointment(oMail As Outlook.MailItem)
'/* Create the Outlook Object and Appointment Item */
MsgBox ("Begin NewAppointment")
Dim app As New Outlook.Application
Dim appointment As AppointmentItem
Dim csvData() As String
Set appointment = app.CreateItem(olAppointmentItem)

csvData = Split(oMail.Subject, ",")
appointment.Subject = csvData(APP_SUBJECT)

appointment.Save
MsgBox ("End NewAppointment-1")

End Sub

If I select the windows live mail calendar and I perform within the Immediate:
? application.activeexplorer.currentfolder.folderpath
it says
\\xxxxvlaming@live.nl\Xxxx's calendar

Please can anyone help? I've read something about defaultfolders but I don't understand it yet.

vlammetje
04-02-2011, 05:20 AM
Is there really no one with experience on this issue? :(

I have also searched for the API of the Outlook Hotmail Connector but couldn't find that also. :((

JP2112
04-04-2011, 01:49 PM
CreateItem will always create the item in your default folder for the item type you specify. For non-default folders, you need to walk the folder hierarchy using the Folders collection. So it would have to be something like


Application.GetNamespace("MAPI").Folders("xxxxvlaming@live.nl").folders("Xxxx's (xxxxvlaming@live.nl%22).folders(%22Xxxx's) calendar")

vlammetje
04-08-2011, 03:00 AM
Thank you very much JP2112.

Thanks to your reply I managed to create an appointment in my non-default windows-live-calendar within outlook. The following statement did the job.


Set appointment = Application.GetNamespace("MAPI").Folders("xxxx@live.nl").Folders("xxxx calendar").Items.Add


Now I can create appointment(s) in my live-calendar by mailing a CSV-file or a CSV-line.