` Printed Icetips Article

Icetips Article



Par2: Calling Outlook using OLE
2000-04-04 -- Jim Kane
 
Here is a very simple program to send mail.  For showing I put a send 
button and called the display method where noramally from a program I 
would just call the send method.
  program
  map
  end
Window WINDOW('outlook'),AT(,,119,100),SYSTEM,GRAY,DOUBLE
       OLE,AT(20,6,80,20),USE(?Ole1)
       END
       BUTTON('Send'),AT(33,79,45,14),USE(?Button1),DISABLE
     END
citem cstring(20)
  code
  open(window)
  accept
  If event()=event:openwindow
    ?ole1{prop:create}='outlook.application'
    cItem=?ole1{'createItem(0)'}
    if citem[1]<>'`' then
      Message('no mail item created - error')
    else
      ?ole1{citem&'.to'} ='peder@pg-d.com'
      ?Ole1{citem&'.from'}='jkane@satx.rr.com'
      ?ole1{citem&'.subject'}='test message'
      ?ole1{citem&'.body'}='text message'
      ?ole1{citem&'.display'} !for testing only
      enable(?button1)
    end
  end
  if event()=event:accepted then
    ?ole1{citem&'.send'}
  end
  if event()=event:closewindow then
    if citem[1]='`' then
      ?ole1{prop:release}=citem
      clear(citem)
    end
    ?ole1{'quit'}
  end
  end
  close(window)

Bob Brooker adds:
to add to Jim's example, you can find the exact properties and methods for
all of the Office Applications at  http://msdn.microsoft.com/resources/libraries.asp 
there are too many to enum here.



Printed November 21, 2024, 7:21 am
This article has been viewed/printed 35228 times.