
RTF - inserting text - difficulties with RTF code stripped by Outlook
Thanks very much for your response Dmitry.
The examples shown are part of a broader process which is triggered by
the Item Send event.
So,
* Send event is triggered
* A bunch of other stuff is done by my code - (permission checking and
so on, doesn't touch the message itself)
* Message is saved to drafts to make RTFBody readable
* The RTF is inserted (at this point, RTF body is as I want it)
* Message is copied and archived (RTFBody still good)
* Control returned to Outlook to complete sending
The RTFBody of the item in the sent items folder has reverted to the
original version before my code touched it.
The most perplexing piece of the puzzle - it only happens for replies.
New messages turn out perfectly.
I have done some further checking with peculiar, reproducible results;
* Save programmatically after the whole RTF (second example below) is
inserted - my changes are lost during the save process.
* Take the RTF and insert into _an_existing_item_ displayed in an
inspector (separate from my addin code, accomplished through
Redemption and Outlook macro interface)
* RTFBody is correct (new) immediately after insertion (checked
using Redemption and Macro interface, displayed text still original as
no refresh on inspector)
* Save to drafts - RTFBody reverts
* Save to desktop in message format format - RTFBody reverts
* Send - RTFBody reverts
* Take the RTF and insert into _a_new_item_ displayed in an inspector
(separate from my addin code, accomplished through Redemption and
Outlook macro interface)
* RTFBody is correct immediately after insertion
* Save to drafts - RTFBody Correct
* Save to desktop in message format format - RTFBody Correct
* Send - RTFBody Correct
This is all on Outlook 2000 SR-1 9.0.0.3821
Conceptually, it looks like Outlook just bars changes to existing
messages.
I can't even figure out how it would tell the difference - same
message class - unless it checks for "Re" in the subject or something
equivalent. Anyone know of a feature like that?
It can't be the OMG at work - I'm using redemption and also the
Outlook version concerned does not have the OMG.
Any ideas gratefully received.
Quote:
> Ian, when do you insert the RTF?
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> > Hope someone can help with this.
> > I am writing some code to insert a disclaimer in RTF formatted
> > messages. I am using Redemption to access and write to the RTFBody
> > text.
> > The text parsing all seems OK, but my insertion is removed from the
> > message when sending replies. My insertion stays in place when
> > generating a new message in RTF.
> > For example in RTF coding - the following is generated by my addin and
> > works fine. This is from a new message.
> > ==========================================
> > {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0
> > Arial;\red0\green0\blue0;}}
> > \viewkind4\uc1\pard
> > \fs20\cf1\par
> > \par
> > ==========\par
> > This message is a personal message from the user. It is not in any
> > way representative of the
> > opinions of the company.\par
> > ==========\par
> > The sender of this message requests that you do not forward this
> > message.\par
> > ==========\par
> > \par\f0\fs20 test223\par
> > }
> > ==========================================
> > When the message is a reply, my code generates the following RTF.
> > This is pulled from debugging the code while replying to a message.
> > ==========================================
> > {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0
> > Arial;\f1\fswiss\fcharset0 Arial;}{\f1\fswiss\fprq2\fcharset0
> > Tahoma;}}
> > {\colortbl
> ;\red0\green0\blue255;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blu
> e0;}
> > \viewkind4\uc1\pard\cf1\f0\fs20 test 217\par
> > \par
> > \f1\fs20\cf4\par
> > \par
> > ==========\par
> > This message is a personal message from the user. It is not in any
> > way representative of the opinions of the company.\par
> > ==========\par
> > The sender of this message requests that you do not forward this
> > message.\par
> > ==========\par
> > \par
> > \pard\li360\cf0\protect\fs24 \lang1024\f1\fs16 -----Original
> > Message-----\par
> > \protect0\pard\protect\fi-1440\li1800\tx1440\b From: \tab\b0 Test1
> > \par
> > \b Sent:\tab\b0 Friday, 17 May 2002 5:51 PM\par
> > \b To:\tab\b0 Test1\par
> > \b Subject:\tab\b0 rtf007\par
> > \par
> > \protect0\pard\protect\li360\cf2\lang1033\f0\fs20 St Red\cf0\par
> > \par
> > \cf1\b Md Blue Bold\cf0\b0\par
> > \par
> > \par
> > \cf3\i End green ital\cf0\i0\par
> > \par
> > }
> > =====================================
> > However, what comes through in the message (both sent folder and
> > inbox) is
> > ======================================
> > {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0
> > Arial;\f1\fswiss\fcharset0 Arial;}{\f1\fswiss\fprq2\fcharset0
> > Tahoma;}}
> > {\colortbl
> ;\red0\green0\blue255;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blu
> e0;}
> > \viewkind4\uc1\pard\cf1\f0\fs20 test 217\par
> > \par
> > \pard\li360\cf0\protect\fs24 \lang1024\f1\fs16 -----Original
> > Message-----\par
> > \protect0\pard\protect\fi-1440\li1800\tx1440\b From: \tab\b0 Test1
> > \par
> > \b Sent:\tab\b0 Friday, 17 May 2002 5:51 PM\par
> > \b To:\tab\b0 Test1\par
> > \b Subject:\tab\b0 rtf007\par
> > \par
> > \protect0\pard\protect\li360\cf2\lang1033\f0\fs20 St Red\cf0\par
> > \par
> > \cf1\b Md Blue Bold\cf0\b0\par
> > \par
> > \par
> > \cf3\i End green ital\cf0\i0\par
> > \par
> > }
> > ================================
> > My insertion is completely removed somewhere between setting the RTF
> > body and Outlook completing the send command. But only when replying.
> > It seems like it's not an object model guard problem as the changes
> > are made to a Redemption safe version of the item.
> > I would truly appreciate some input.