我正在尝试设置TaskItem的RTFBody属性(使用Office PIA)。下面是我正在尝试做的事情的片段,它正在抛出异常。有人试过以前设置RTFBody,如果有,你是怎么做的?
Dim oApp As Outlook.Application = New Outlook.Application
Dim t As Outlook.TaskItem = DirectCast(oApp.CreateItem(Outlook.OlItemType.olTaskItem), Outlook.TaskItem)
t.Status = Outlook.OlTaskStatus.olTaskNotStarted
t.Importance = Outlook.OlImportance.olImportanceNormal
t.Subject = "test subject"
t.RTFBody = System.Text.Encoding.ASCII.GetBytes("{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}{\*\generator Riched20 15.0.4599}{\*\mmathPr\mwrapIndent1440 }\viewkind4\uc1 \pard\f0\fs22 Test Body: First Line\parSecond Line of Text\par}")
我可以在调试时检索RTFBody属性,但无法设置它。