FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Urgent problem
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Urgent problem
Posted: Mon Oct 22, 2007 09:30 AM

Hello,

Already several times, I asked about some more information concerning communications with Microsoft Outlook through OLE.

My customers are asking for more possibilities in this almost every day.

Until now, nobody has given me a satisfying answer.

What do I need :

  • Sending and receiving emails from Outlook
  • Synchronisation with the Outlook Calender
  • Saving the attachments from a e-mail-message
  • Exporting data to Excel
  • ...

Please can someone tell me if a solution is possible ? To my opinion there is a great need for such solutions. It's one of the issues of modern software.

I hope someone can help me because I'm getting disperate.

Thank you very much in advance.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Urgent problem
Posted: Mon Oct 22, 2007 10:03 AM

Michel

here are some handy functions for outlook

For email, there has been many threads in this forum.

Functions below are used by my app

define outlookFolderCalendar 9

define olFolderContacts 10

FUNCTION AJRDV( cDate, cTime, nLenInMin, cObjet, cNote ) // cdate format jj/mm/aaaa ctime format hh:mns EXEMPLE 10:20
LOCAL oOutlook,hApptItem,oNameSpace,ocalendar,hOutlook, ;
lSave := .F., ;
lFOUND := .F., ;
I := 0
TRY
oOutlook := CREATEOBJECT( "Outlook.Application" )

oNameSpace := oOutlook:GetNameSpace("MAPI")
ocalendar := oNameSpace:GetDefaultFolder(outlookFolderCalendar )

FOR I = 1 TO ocalendar:Items:Count
IF DTOS(ocalendar:Items[ i ]:START) = DTOS(CTOD(CDATE)) .AND. ocalendar:Items[ i ]:SUBJECT = cObjet ;
.AND. ocalendar:Items[ i ]:Body = cNote .AND. ocalendar:Items[ i ]:Duration = NLeninmin
LFOUND := TRUE
I := 1000000
ENDIF
NEXT

IF ! LFOUND // NOUVEAU

  hOutlook  := CreateOLEObject( "Outlook.Application" )
  hAppItem  := OLEInvoke( hOutlook, "CreateItem", 1 )

  OLESetProperty( hAppItem, "Start", CDate + " " + cTime)

  OLESetProperty( hAppItem, "Duration", nLenInMin )
  OLESetProperty( hAppItem, "Subject", cObjet )
  OLESetProperty( hAppItem, "Body", cNote )
  OLESetProperty( hAppItem, "Mileage", 225 )
  OLEInvoke( hAppItem, "Save" )
  hAppItem := NIL
  hOutlook := NIL

ENDIF

OOutlook := NIL
lSave := .t.
CATCH
lSave := .f.
END
RETURN (lSave)

FUNCTION AJTACHE( cDate, cObjet, cNote, 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() )
OLESetProperty( hAppItem, "Duration", 60 )
OLESetProperty( hAppItem, "Subject", cObjet )
OLESetProperty( hAppItem, "Body", cNote )
OLESetProperty( hAppItem, "StartTime", cTime + ":00" )
OLEInvoke( hAppItem, "Save" )
hAppItem := NIL
hOutlook := NIL
lSave := .t.
CATCH
lSave := .f.
END
RETURN (lSave)

FUNCTION READOUTLOOK()

LOCAL oOutlook := CREATEOBJECT( "Outlook.Application" )
LOCAL oNameSpace := oOutlook:GetNameSpace("MAPI")
LOCAL oContacts := oNameSpace:GetDefaultFolder( olFolderContacts )


LOCAL i

FOR i = 1 TO oContacts:Items:Count
    ? oContacts:Items[ i ]:FullName
    ? oContacts:Items[ i ]:BusinessAddressStreet
    ? oContacts:Items[ i ]:BusinessAddressPostalCode
    ? oContacts:Items[ i ]:BusinessAddressCity
    ? oContacts:Items[ i ]:BusinessAddressState
    ? oContacts:Items[ i ]:BusinessAddressCountry
    ? oContacts:Items[ i ]:BusinessTelephoneNumber
    ? oContacts:Items[ i ]:Email1Address
    ? oContacts:Items[ i ]:LastModificationTime
    ?
NEXT

oOutlook:Quit()

RETURN NIL

hth

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Urgent problem
Posted: Mon Oct 22, 2007 10:29 AM

Richard,

Thank you very much.

I'll try it out as soon as possible.

This is a step I was looking for.

Many, many thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 39
Joined: Thu Apr 05, 2007 12:52 AM
Urgent problem
Posted: Thu May 08, 2008 01:17 AM

Hey, Driessen,

Does this work?

Toyet Amores

Thanks,

Toyet Amores

-----------------------------------------------------------------------

xHarbour/Fivewin/Harbour/BCC582/DBMS:Oracle/MySQL

-----------------------------------------------------------------------

Continue the discussion