Urgent question about Outlook

Post Reply
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Urgent question about Outlook

Post by driessen »

Hello,

I urgently need some WORKING examples for my FW application to :

1. Read an appointment out of Outlook
2. Write an appointment to Outlook
3. Read a task out of Outlook
4. Write a task to Outlook
5. Read messages from the Inbox.

Can someone provide these to me ?

Thank you very much in advance.

Michel
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Urgent question about Outlook

Post by Enrico Maria Giordano »

This is a working sample for Inbox:

Code: Select all

#define olFolderInbox 6


FUNCTION MAIN()

    LOCAL oOutlook := CREATEOBJECT( "Outlook.Application" )
    LOCAL oNameSpace := oOutlook:GetNameSpace("MAPI")
    LOCAL oInbox := oNameSpace:GetDefaultFolder( olFolderInbox )

    LOCAL i

    FOR i = 1 TO oInbox:Items:Count
        ? oInbox:Items[ i ]:Body
        ?
    NEXT

    oOutlook:Quit()

    RETURN NIL
EMG
User avatar
NK
Posts: 97
Joined: Sun Nov 20, 2005 4:32 pm
Location: Germany
Contact:

Re: Urgent question about Outlook

Post by NK »

Sample for Add-Task

Code: Select all

FUNCTION AddOLTask( cDate, cSubject, cNotiz, cTime )

   LOCAL hOutlook, hAppItem, dDate
   LOCAL lSave := .f.
   TRY
      hOutlook := CreateOLEObject( "Outlook.Application"
      hAppItem := OLEInvoke( hOutlook, "CreateItem", 3 )
      dDate := CToD( cDate )
      OLESetProperty( hAppItem, "DueDate", dDate )
      OLESetProperty( hAppItem, "Remindertime", cDate + " " + cTime )
      OLESetProperty( hAppItem, "ReminderSet", "Y" )
      OLESetProperty( hAppItem, "StartDate", Date() )
      SET CENTURY ON
      SET Date TO GERMAN
      OLESetProperty( hAppItem, "Duration", 60 )
      OLESetProperty( hAppItem, "Subject", cSubject )
      OLESetProperty( hAppItem, "Body", cNotiz )
      OLESetProperty( hAppItem, "StartTime", cTime + ":00" )
      OLEInvoke( hAppItem, "Save" )
      hAppItem := NIL
      hOutlook := NIL
      lSave := .t.
   CATCH
      lSave := .f.
   END
RETURN (lSave)

User avatar
NK
Posts: 97
Joined: Sun Nov 20, 2005 4:32 pm
Location: Germany
Contact:

Re: Urgent question about Outlook

Post by NK »

Sample Add appointment

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
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Post by driessen »

Thanks, guys.

I'll try out your code.

And I hope there is more to come here.

Thank you su much.

Michel
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Post Reply