0

I have been working on creating appointments from Powershell in Outlook. Everything seems to be working with the exception of being able to set the appointment.RTFBODY. It looks like it is stored as a byte array, but despite my best efforts and many attempts I have been unable to set it. Any suggestions would be much appreciated. http://pastebin.com/kQvGfNRS

Edit: I was able to find what could be a similar issue. https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5dba0d12-94e8-47a5-b082-93d3693e2a47/cant-set-the-rtfbody-of-an-appointmentitem "I assume you add a wrong version reference. If you add Microsoft.Office.Interop.Outlook 12.0, I could reproduce your issue. I suggest you remove this reference, and add Microsoft.Office.Interop.Outlook 14.0."

Also found this: Outlook AppointmentItem - How do I programmatically add RTF to its Body?

Community
  • 1
  • 1
John Galt
  • 9
  • 4

1 Answers1

0

from the link in your question - "it is just a known problem in OOM - setting the RtfBody property using early binding works. Setting through IDispatch::GetIDsIfNames / Invoke does not."

Powershell always uses late bindings (i.e. you cannot declare a variable as an instance of a particular object. e.g. AppointmentItem).

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • thanks Dmitry. it looks like powershell set the appointment to interop 14.0 and not 12.0 which was the one that couldn't do rtfbody – John Galt Mar 21 '16 at 17:27