Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Question to outlook.application

Former Member
0 Likes
1,749

Hi,

i use this code to send an email via Outlook:

CREATE OBJECT LR_OU 'Outlook.Application'.

CALL METHOD OF LR_OU 'CreateItem' = LR_MI

  EXPORTING #1 = 0.

*

SET PROPERTY OF LR_MI 'To'      = '[email protected]'.

*

SET PROPERTY OF LR_MI 'Subject' = 'Subject'.

*

SET PROPERTY OF LR_MI 'Body'    = 'Bodytext'.

*

CALL METHOD OF LR_MI 'Display'.

*

FREE OBJECT LR_OU.

This works OK but i missed my Default signature from Outlook, therfore i have to set the

button signature in the Email.

Is it possible to set any proberty to set the Default signature?

Is there an documentation to use Outlook.Application?

Thnaks.

Regards, Dieter

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,463

As far as I remember (no VBA since some years now) the signature is there by default, but it was erased when body of the mail was changed (it is part of the body). So you could try to read the body (GET PROPERTY), then add a new-line and the signature to your Abap mail body and set it back in the mail ?

NB:

- you may need to have another call of display method (to be able to read signature)

- you could test, comment the property set of body, does the mail contain the default signature

Regards,

Raymond

Hi,

i use this code to send an email via Outlook:

CREATE OBJECT LR_OU 'Outlook.Application'.

CALL METHOD OF LR_OU 'CreateItem' = LR_MI

  EXPORTING #1 = 0.

*

SET PROPERTY OF LR_MI 'To'      = '[email protected]'.

*

SET PROPERTY OF LR_MI 'Subject' = 'Subject'.

*

SET PROPERTY OF LR_MI 'Body'    = 'Bodytext'.

*

CALL METHOD OF LR_MI 'Display'.

*

FREE OBJECT LR_OU.

This works OK but i missed my Default signature from Outlook, therfore i have to set the

button signature in the Email.

Is it possible to set any proberty to set the Default signature?

Is there an documentation to use Outlook.Application?

Thnaks.

Regards, Dieter

8 REPLIES 8
Read only

Former Member
0 Likes
1,463

Hi Dieter,

The signatures are local to the user and will work only in foreground mode....

You will need to upload the signature from the local file....

DATA: OS_USER TYPE STRING .

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_USER_NAME

  CHANGING

    USER_NAME            = OS_USER

  EXCEPTIONS

    CNTL_ERROR           = 1

    ERROR_NO_GUI         = 2

    NOT_SUPPORTED_BY_GUI = 3

    OTHERS               = 4.

Filename =

"C:\Documents and Settings\" + OS_USER + "\Application Data\Microsoft\Signatures\" + outlook_user + "." + file_ext.

Read this file and add it to the body text.

Regards

Read only

Former Member
0 Likes
1,463

Hi Mohammed,

thanks for your answer. I find the signature as you has shown. The Problem is, that we have in this signature some formatted text.

I hoped there will be some possibility, to use some proberty or method from 'Outlook.Application' that simulate the button 'signature' when creating a new email.

Regards, Dieter

Read only

0 Likes
1,463

Well Dear,

I am sorry but there is not any in Outlook to read signatures as they are not stored in the mail client but as local files at client place.

Well the data you uploaded will be RTF [Rich text format] so it would be giving you issues.

Upload it and use FM SO_RTF_TO_RAW.

Regards

Read only

0 Likes
1,463

Hi,

thanks, but as i have mentioned above, i only want a solution by simulate

pressing the button signature in an email:

I think there will be no way, therefore i close this thread.

Thanks again.

regards, dieter

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,464

As far as I remember (no VBA since some years now) the signature is there by default, but it was erased when body of the mail was changed (it is part of the body). So you could try to read the body (GET PROPERTY), then add a new-line and the signature to your Abap mail body and set it back in the mail ?

NB:

- you may need to have another call of display method (to be able to read signature)

- you could test, comment the property set of body, does the mail contain the default signature

Regards,

Raymond

Read only

0 Likes
1,463

Hi Raymond,

thanks. First i use Body, but the signature i get is not formatted like the "normal" signature.

Than i try Htmlbody and i get the signature like i need. But i get the next

Problem. My own bodytext (1. Betreff etc) has no newline, so i get my hole own bodytext in

one line. Do you have any idea?

CALL METHOD OF LR_MI 'Display'.

*

*GET PROPERTY OF LR_MI 'body'         = WA_SIGN.

GET PROPERTY OF LR_MI 'Htmlbody'     = WA_SIGN.

*

* Emailtext

CONCATENATE '1. Betreff'

            '2. Betreff'

            '3. Betreff'

            INTO WA_BODY SEPARATED BY C_NEWL.

CONCATENATE WA_BODY WA_SIGN INTO WA_BODY.

*SET PROPERTY OF LR_MI 'body'       = WA_BODY.

SET PROPERTY OF LR_MI 'htmlbody'    = WA_BODY.

Regards, Dieter

Read only

0 Likes
1,463

Try to add some html tags into your text '1 Bettref' -> <p>1 Bettref</p>

Regards,

Raymond

Read only

0 Likes
1,463

Hi Raymond,

thanks, thats what i need. I try this:

CONCATENATE
            '<p>first Line</p>'
            'second Line</p>'
            'third Line</p>'
            INTO WA_BODY.


There is still a little problem because i get an empty line after "first line" but it's

no Problem and my knowledge is not really good in html.

Thanks again

Regards Dieter