none
Get Appointment.HTMLBody. Outlook 2016 RRS feed

  • Question

  • Hello guys,

    I've noticed that by contrast to Outlook 2010 & 2013, Outlook 2016 has the possibility to change the format of the text (Html/PlainText/RichText). I mean Outlook UI.

    I have installed the last VSTO Update 2 for VS 2015 , referenced Microsoft.Office.Interop.Outlook. C:\Program Files (x86)\Microsoft Visual Studio 14.0\Visual Studio Tools for Office\PIA\Office15\Microsoft.Office.Interop.Outlook.dll and I still don't see HTMLBody in AppointmentItem interface. Am I doing something wrong or this interface hasn't been updated and  HTMLBody isn't added?

    If so, how can I get HTMLBody from Appointment and how can I insert some HTML into it?

    Thanks.

    Tuesday, November 29, 2016 4:53 PM

All replies

  • Hello,

    You are on the wrong avenue. There were no breaking changes for the UI or message bodies.

    Appointment items use the RTF markup for bodies instead of HTML (see the RTFBody property). So, you will not find the HTMLBody property for appointments. You can use the Word object model if you need to paste some HTML markup to the body. See Write HTML content to word document using C# for more information. 


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Tuesday, November 29, 2016 7:34 PM
  • Yes, appointments in Outlook 2016 now support HTML. Unfortunately AppointmentItem.HTMLBody property had not been added to the Outlook Object Model.

    You can try to access the PR_HTML property (DASL name http://schemas.microsoft.com/mapi/proptag/0x10130102) using AppointmentItem.PropertyAccessor.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, November 30, 2016 6:07 PM
  • To be precise, MAPI allows to set the HTML markup as the message body (PR_HTML). Outlook doesn't provide anything for that (OOM).

    Moreover, as far as I know PropertyAccessor has a limitation, it allows to set only properties less than 16K. Devs should use the OpenProperty method or any other third-party components (for example, Redemption).


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Wednesday, November 30, 2016 9:24 PM
  • I observed that if one does not save the appointment, PR_HTML will either not exist (if new) or not be updated (if already created).

    Is it possible to get the updated PR_HTML without saving the appointment?
    (e.g one wants to get HTML content inside an event handler of AppointmentItemClass.Write event)

    Friday, March 2, 2018 10:13 AM
  • No. Outlook updates MAPI properties only when the item is saved.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, March 2, 2018 2:45 PM
  • Then saving on pc as HTML format would do the job right? (Inspector.WordEditor.SaveAs method)
    Tuesday, March 6, 2018 5:28 PM
  • That sounds like a possible workaround. Does it work for you?  

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, March 6, 2018 7:50 PM
  • Yes, the src attribute of img html tag is different but that is fine. It saves images in seperate folder, so there is extra clean to do.
    Wednesday, March 7, 2018 4:54 PM