Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Outlook Address Book

70 views
Skip to first unread message

Andy S

unread,
Mar 4, 2010, 7:44:38 AM3/4/10
to
i'm using the following code to send a mail using a outlook OLE
i need to open the address book similar to the mailaddress function of
the mailsession object.
Please help
Thanks

Oleobject lole_session, lole_msg, lole_attach
string ls_address
integer li_rc
integer i

lole_session = CREATE OLEObject

// Activate the OutLook application and check if it was activated
properly.
li_rc = lole_session.ConnectToNewObject("outlook.application")

IF li_rc <> 0 THEN
gnv_messages.of_display("FRW5003")
DESTROY lole_session
RETURN False
END IF


// Create the message object and set some of its properties such as
tyhe message subject and
// message body.
lole_msg = CREATE OLEObject

lole_msg = lole_session.CreateItem(0)

lole_session.

lole_msg.Subject = as_subject

lole_msg.Body = as_message_text


// Set the list of files attached to the message
IF UpperBound(as_file_attachments[]) > 0 THEN
lole_attach = CREATE OLEObject

lole_attach = lole_msg.Attachments

FOR i = 1 TO UpperBound(as_file_attachments[])
lole_attach.Add(as_file_attachments[i])
END FOR
END IF


// Set the list of addresses for the "To" section (seperated by
semicolons)
IF UpperBound(as_address[]) > 0 THEN
ls_address = as_address[1]

FOR i = 2 TO UpperBound(as_address[])
IF as_address[i] > "" THEN
ls_address += "; " + as_address[i]
END IF
END FOR

lole_msg.To = ls_address
END IF


// If requested: Display the outlook application message window
IF ab_show_outlook_application THEN
lole_msg.Display
END IF


// If requested: Send the message
IF ab_send_message THEN
lole_msg.Send //send the message
END IF


DESTROY lole_session
DESTROY lole_msg


// If requested, then delete the attached files
this.of_delete_temp_files(ab_delete_files_after_send,
as_file_attachments)

RETURN True

0 new messages