Outlook Automation

Andy Hilton andyh at totallybrilliant.com
Wed Mar 4 13:23:08 EST 2015


Does anyone know if there is an Outlook automation command to output an email message as plain text ?

I have code that handles creating a file of an Outlook message (it comes out as a .msg file) - but I have some environments where not everyone uses the same app for emails (i.e. not all using Outlook) so I am looking to change saving the email message from being an Outlook ‘file’ to being plain text (so save it as a .txt file instead)

I can just save the file I get from Outlook as a .txt file but it includes the binary gunk at the beginning - and I am sure there must be a way to output the text only portion…..

So just seeing if anyone has that to hand to save reinventing !!

Andy

ps this is what I have at the moment :

On evDrop

……….other stuff……..

If cn.$:Platform=kMSWindows
;  could be an Outlook drop
Do method GetAutomationObject ("Outlook.App") Returns oOutlook
If not(isnull(oOutlook))
Do oOutlook.$createobject()
If not(isnull(oOutlook))
Do oOutlook.$activeexplorer() Returns oActiveExplorer
If not(isnull(oActiveExplorer))
Do oActiveExplorer.$selection() Returns oSelection
If not(isnull(oSelection))
Calculate xCount as oSelection.$xcount
For xCountItemNumber from 1 to xCount step 1
Calculate oMailItem as oSelection.$item(xCountItemNumber)
If not(isnull(oMailItem))
……..go ahead and save the file……..
Do oMailItem.$saveas(con(local_prefs.$:ImagesFolderPath(),MainID,'-',lCounter,'.msg'))




More information about the omnisdev-en mailing list