Urgent problem

Urgent problem

Postby driessen » Mon Oct 22, 2007 9: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. 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 problem

Postby Richard Chidiak » 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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby driessen » 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. 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

Postby toyet » Thu May 08, 2008 1:17 am

Hey, Driessen,

Does this work?

Toyet Amores
User avatar
toyet
 
Posts: 39
Joined: Thu Apr 05, 2007 12:52 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Willi Quintana and 71 guests