[Prev][Next][Index][Thread]
More COM questions
Hey Dylan COM experts, try this one. I have successfully created an Outlook
interface and started getting information from Outlook. When I get to the
point of actually grabbing mail (they are MailItem objects), the return
type from the Items/Item function is <LPDISPATCH> not <MailItem>. Actually
what it returns is a <c-interface> object. How do I convert that
<c-interface> object into a <MailItem> object. I should mention that
<MailItem> is one of the classes created by Functional Dylan through the COM
wizard when I gave it the Outlook object library. Here's an example that I
started to cobble together:
// Assumes OLE-initialize has been called.
define method Get-Inbox( ) => ( result :: <sequence> )
let inbox-items = make( <sequence> );
let Outlook-interface =
reate-dispatch( "{0006F033-0000-0000-C000-000000000046}",
context: $CLSCTX-SERVER );
assert ( Outlook-interface ~= #f );
let application = make( <_DApplication>, disp-interface:
Outlook-interface );
let namespace = _DApplication/GetNamespace( application, "MAPI" );
let defaultFolder = NameSpace/GetDefaultFolder( namespace,
$olFolderInbox );
let items = defaultFolder/Items;
for ( i from 1 below Items/Count( items ) )
// returns a <c-interface> object. How do you convert that into
// a MailItem object?
inbox-items[ i ] := Items/Item( i );
end for;
...
Thanks in advance for any help.