I am trying to create a formatted appointment body but the only method
I can see in the appointmentItem is body. This method only writes the
plain text not the formatted html body.
what i simply like to do is
appointmentItem.HTMLBody = emailItem.HTMLBody
but the HTMLBody is not availabe under AppointmentItem :(
So, what is the approach of formatting an appointment body?
Thank you.
Dim appointmentItem As Outlook.AppointmentItem =
Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olAppointmentItem)
CopyEmailBodyToAppointmentBody(selectedMail, appointmentItem)
'--------------------
Private Function CopyEmailBodyToAppointmentBody(ByVal email As
Microsoft.Office.Interop.Outlook.MailItem, _
ByVal appointment As
Microsoft.Office.Interop.Outlook.AppointmentItem) As Boolean
If email Is Nothing OrElse appointment Is Nothing Then
Return False
End If
Try
Dim emailWordDocument As Microsoft.Office.Interop.Word.Document
= email.GetInspector.WordEditor
Dim emailWordSelection As
Microsoft.Office.Interop.Word.Selection =
emailWordDocument.Windows(1).Selection
Dim appointmentWordDocument As
Microsoft.Office.Interop.Word.Document =
appointment.GetInspector.WordEditor
Dim appointmentWordSelection As
Microsoft.Office.Interop.Word.Selection =
emailWordDocument.Windows(1).Selection
emailWordSelection.WholeStory()
emailWordSelection.Copy()
appointmentWordSelection.PasteAndFormat(Microsoft.Office.Interop.Word.WdRecoveryType.wdPasteDefault)
'<---- Error
' Error = This method or property is not available because the
document is locked for editing.
' I am clueless on resolving this. What do I need to do to
resolve this? Thanks.
Catch ex As Exception
Return False
End Try
Return True
End Function
Original Source Code : http://www.outlookcode.com/codedetail.aspx?id=2040
Thanks for your help.
Musa.
You would have to create syntactically correct RTF text and write it to that
property. You may want to re-think your efforts, RTF is a real beast to work
with. Also, in Outlook 2007 the PropertyAccessor will be able to write that
property but won't be able to read it if the contents of the property are
larger than about 8 KB.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"musa.biralo" <musa....@gmail.com> wrote in message
news:a7e76c13-d567-45bf...@37g2000yqm.googlegroups.com...
From the post of Sue in http://www.outlookcode.com/codedetail.aspx?id=2040
it does not appear that it will be too hard.
The problem, i got stuck at is now little bit different:
Error = "This method or property is not available because the document
is locked for editing". Second post from bottom shows where this error
is coming from
How can I resolve this?
Thanks
On May 3, 9:13 am, "Ken Slovak - [MVP - Outlook]" <kenslo...@mvps.org>
wrote:
> There is no HTMLBody property because that type of item doesn't support
> HTML. You can only provide formatting using RTF (Rich Text format) and
> provide it in the PR_RTF_COMPRESSED property, which is a binary property
> (you'd write to it as an array of hex coded bytes). The DASL property tag
> for PR_RTF_COMPRESSED is
> "http://schemas.microsoft.com/mapi/proptag/0x10090102".
>
> You would have to create syntactically correct RTF text and write it to that
> property. You may want to re-think your efforts, RTF is a real beast to work
> with. Also, in Outlook 2007 the PropertyAccessor will be able to write that
> property but won't be able to read it if the contents of the property are
> larger than about 8 KB.
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm
>
> "musa.biralo" <musa.bir...@gmail.com> wrote in message
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"muas" <mine...@gmail.com> wrote in message
news:ad17c3ed-c000-456e...@h9g2000yqm.googlegroups.com...