Urgent question about Outlook

Urgent question about Outlook

Postby driessen » Tue Mar 20, 2007 3:43 pm

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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Urgent question about Outlook

Postby Enrico Maria Giordano » Tue Mar 20, 2007 6:11 pm

This is a working sample for Inbox:

Code: Select all  Expand view
#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
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Urgent question about Outlook

Postby NK » Wed Mar 21, 2007 6:18 pm

Sample for Add-Task

Code: Select all  Expand view
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

Re: Urgent question about Outlook

Postby NK » Wed Mar 21, 2007 6:24 pm

Sample Add appointment

Code: Select all  Expand view
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
NK
 
Posts: 97
Joined: Sun Nov 20, 2005 4:32 pm
Location: Germany

Postby driessen » Thu Mar 22, 2007 1:02 am

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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 47 guests