Appointment RTF format problems using Redemption

J

John Svercek

I am developing an addin for Outlook 2000 using vb6 and Redemption. The addin
inserts code into the body of an appointment when a button is clicked. I have
two problems, 1) when the RTF text is added to the body the format characters
are no longer there, and 2) the added text does not show until I go thru the
code a second time, this results in the previous text appearing and the
current text is not visible.

Here is my code snippet that adds the text.

Any suggestions would be appreciated.

Thanks, John



Dim MyAptmntItm As Object
Dim MyOAptmntItm As Object
Dim BdyPstn As Long
Dim HoldMsg As String

If TypeOf m_oApp.ActiveInspector.CurrentItem Is Outlook.AppointmentItem Then

'create SafeAppointmentItem from this appointment
Set MyAptmntItm = CreateObject("Redemption.SafeAppointmentItem")
Set MyOAptmntItm = m_oApp.ActiveInspector.CurrentItem
MyOAptmntItm.Save
MyAptmntItm.Item = MyOAptmntItm

'Need to put something in the body & save it so the rtf header
information is created
MyAptmntItm.Body = MyAptmntItm.Body & vbCrLf
MyAptmntItm.Save

'copy body to string & manipulate it
HoldMsg = MyAptmntItm.rtfBody
'JCS FIX need to find the last } & break message just before it,
'for now hard code it
BdyPstn = Len(HoldMsg) - 4
'add bold text to appointment body in RTF format
HoldMsg = Left(HoldMsg, BdyPstn) & " \b TEST \b0\par }"
MyAptmntItm.rtfBody = HoldMsg
MyAptmntItm.Save

Set MyAptmntItm = Nothing
Set MyOAptmntItm = Nothing
End If
 
D

Dmitry Streblechenko

1. I am not sure that the way you manipulate the RTfFbody produces valid RTF
data. Did you try to save it to a file and open using WordPad?
2. Outlook does not see changes made with Extended MAPI (Redemption) until
the item completely dereferenced and reopened.

You might want to use SafeInspector object instead (swince you are
apparently displaying the appointment anyway). Use the RTFEditor object to
manipulate the modify the RTF contents.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top