One of the Outlook's feature is Calendar which it make possible to user to create their own schedule and will remind for it. It's very useful for people who has many schedules in their life.
In this part of session, I will try to explain how to insert or create a new appointment in outlook, programmatically, with Powerbuilder. One thing you should learn and know is Outlook Object Model, which you can find at Microsoft's MSDN site.
Microsoft has prepared the AppointmentItem Class which has many properties, to create a new Appointment Object in Microsoft Outlook Calendar. Some properties that are commonly used for the calendar class are: Subject, Start, Duration, and Reminder.
First, you (or PC clients) must has Microsoft Outlook installed. Then at the script, you must declare OleObject variable type, than try to create the object and connect to Microsoft Outlook Object. In this example, I'm using Microsoft Outlook 2007 and Powerbuilder 6.5. Here's the full script to create a new Appointment Object:
// declare OleObject variable and Constant Variable
oleobject oleOutlook
oleobject oleAppt
Constant Integer olAppointmentItem = 1
oleobject oleAppt
Constant Integer olAppointmentItem = 1
// create the Object
oleOutlook = create oleobject
oleOutlook = create oleobject
// Connect To the Outlook Object
oleOutlook.ConnectToNewObject ('Outlook.Application')
oleOutlook.ConnectToNewObject ('Outlook.Application')
// Create the Appointment Object
oleAppt = oleOutlook.CreateItem (olAppointmentItem)
oleAppt = oleOutlook.CreateItem (olAppointmentItem)
// Set some common properties of Appointment Object
oleAppt.Location = "Home"
oleAppt.Subject = "Watch Fulham vs Manchester United Live"
oleAppt.Start = "08/21/2010 19:00"
oleAppt.ReminderMinutesBeforeStart = 1 // in minute
oleAppt.Duration = 120 // in minute
oleAppt.Body = "Go MU !!! Go !!!"
oleAppt.Location = "Home"
oleAppt.Subject = "Watch Fulham vs Manchester United Live"
oleAppt.Start = "08/21/2010 19:00"
oleAppt.ReminderMinutesBeforeStart = 1 // in minute
oleAppt.Duration = 120 // in minute
oleAppt.Body = "Go MU !!! Go !!!"
oleAppt.Save
And here the result of the example:
Hi,
ReplyDeleteThis was very useful! Could you please post, how it's possible to send mails with Powerbuilder via Outlook 2007.
Thank you for your help in advance.
Imre
Hi Imre, try to see at http://howtosolvethat.blogspot.com/2010/12/sending-email-with-powerbuilder.html to sending the email within Powerbuilder
ReplyDelete