Create appointment in outlook

Post Reply
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Create appointment in outlook

Post by cdmmaui »

Hello,

Can you someone provide an example of how to create an appointment in outlook.

Thank you,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

I copied this from another message. I have never tried it and you probably don't need the SET DATE TO GERMAN unless you are Germany.

James

Code: Select all

FUNCTION AddOLappointment( cDate, cTime, nLenInMin, cSubject, cNotiz ) 

   LOCAL hOutlook 
   LOCAL hApptItem 
   LOCAL dDate 
   LOCAL lSave := .F. 
   TRY 
      hOutlook  := CreateOLEObject( "Outlook.Application" ) 
      hAppItem  := OLEInvoke( hOutlook, "CreateItem", 1 ) 

      SET CENTURY ON 
      dDate := CToD( cDate ) 
      OLESetProperty( hAppItem, "Start", cDate + " " + cTime ) 
      OLESetProperty( hAppItem, "StartTime", cTime + ":00" ) 
      SET CENTURY ON 
      SET Date TO GERMAN 
      OLESetProperty( hAppItem, "Duration", nLenInMin * 60 ) 
      OLESetProperty( hAppItem, "Subject", cSubject ) 
      OLESetProperty( hAppItem, "Body", cNotiz ) 
      OLESetProperty( hAppItem, "Mileage", 225 ) 
      OLEInvoke( hAppItem, "Save" ) 
      hAppItem := NIL 
      hOutlook := NIL 
      lSave := .t. 
   CATCH 
      lSave := .f. 
   END 
RETURN (lSave) 
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Post by cdmmaui »

Hi James,

Thanks for your help!

Regards,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

James, why do you use OLEInvoke() and OLESetProperty() instead of the common object oriented syntax? As an example:

hAppItem := hOutlook:CreateItem( 1 )

And, by the way, I would name hOutlook and hAppItem as oOutlook and oAppItem.

EMG
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Enrico,

>James, why do you...

I didn't write it.

James
Post Reply