How to Add My Outlook Email Signature to the Com Object Using Rdcomclient

How to add my Outlook email signature to the COM object using RDCOMClient

Consider using Outlook's GetInspector() property. Assuming you have an auto-signature, assign a variable to capture the default body and then concatenate to your latter message:

library(RDCOMClient)

olMailItem = 0
OutApp <- COMCreate("Outlook.Application")
outMail <- OutApp$CreateItem(olMailItem)

outMail$GetInspector()
signature = outMail[["HTMLBody"]]

outMail[["Recipients"]]$Add("dest@dest.com")
outMail[["Subject"]] = "some subject"
outMail[["HTMLBody"]] = paste0('<p>some body', signature, '</p>')

outMail$Display()
outMail <- NULL
OutApp <- NULL

Full list of methods for COM objects

If you have Outlook, Excel or Word installed then you can do the following ...

  1. Press F11 to get to a Visual Basic Application (VBA) Integrated Development Environment (IDE).
  2. On the menu bar go to Tools->References to prompt the References dialog box.
  3. On the References dialog box, in the Available References checkbox list, page down until you find Microsoft Outlook Library (or similar), once found then check the checkbox and then press OK to confirm selection and dismiss dialog. This adds a reference to the Outlook type library to the current project.
  4. With the Outlook type library referenced (see step (3)) one can now press F2 to show the Object Browser dialog box.
  5. In the Object Browser dialog box, select the top left dropdown list which will probably say <All Libraries> . Change the dropdown so it says Outlook, this will scope the object browser to just the Outlook type library.
  6. You can now browse all the objects in the Outlook type library. Select a class in the Classes pane on the left hand side and the class's methods will appear in the right hand side.

Enjoy!



Related Topics



Leave a reply



Submit