Sue Mosher said:
Nope. Only MailItem and PostItem objects have an HTMLBody property. Appointment bodies are rich text, and that formatted content isn't exposed in the Outlook object model until Office 2007, where you can get at it indirectly through WordEditor. See
http://www.outlookcode.com/d/formatmsg.htm for ideas for earlier versions.
As usual Sue, you're a gem!
Hmm, first on the Word method:
---------------
It seems with WordEditor that my code will still trigger security,
which I absolutely don't want.
I'm guessing the code would looks something like this:
olAppointmentItem myappt = myGetAppt()
olInspector objInsp = myappt.GetInspector()
Word.Document objDoc = objInsp.WordEditor
From there I'm wondering how I can convert the HTML into Doc format.
The only thing I can think of is to do something like this:
objDoc.SaveAs(
FileName:="trash.htm",
FileFormat:=Word.WdSaveFormat.wdFormatHTML
....
And then I should be able to load in the DHTML and "myappt.Save".
If that's the case it seems a little precarious. It also introduces
the overhead of loading Word on top of Outlook.
---------------
It looks like this is where I need to break from PIA and use
Redemption. I'm assuming the code will look something like this:
olAppointmentItem myappt = myGetAppt()
sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = myappt.GetInspector()
myHTMLeditor = sInspector.HTMLeditor
At this point I get lost for a couple reasons:
1) The online doc for Redemption doesn't document HTMLEditor.
http://www.dimastr.com/redemption/safeinspector.htm
2) Extrapolating from the doc that's there, I should be able to set a
..SelText or similar property, or maybe InnerHTML if going through the
DOM.
3) My code isn't running within the Outlook process, I've instantiated
from my own executable using PIA:
olapp = new PIA.Outlook.ApplicationClass();
Based on a comment on that help page for the RTFEditor, I'm not sure
which property is available for r/w of HTML text.
4) Just how sophisticated can the HTML be when using HTMLEditor? If
it doesn't process styles then I need to work something else out.
Now is probably a good time to actually load Redemption and maybe
OutlookSpy.
Thanks!!