RTF - inserting text - difficulties with RTF code stripped by Outlook 
Author Message
 RTF - inserting text - difficulties with RTF code stripped by Outlook

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

Quote:
}

==========================================

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\blue0;}
\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

Quote:
}

 =====================================

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\blue0;}
\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

Quote:
}

 ================================

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.



Fri, 05 Nov 2004 12:39:37 GMT  
 RTF - inserting text - difficulties with RTF code stripped by Outlook
Ian, when do you insert the RTF?

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


Quote:
> 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;}

- Show quoted text -

Quote:
> \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;}

- Show quoted text -

Quote:
> \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.



Sat, 06 Nov 2004 00:15:30 GMT  
 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.



Sun, 07 Nov 2004 08:53:06 GMT  
 RTF - inserting text - difficulties with RTF code stripped by Outlook
So it looks like Outlook forgets that the body had been already saved and
overwrites it again even if you have explicitly called Save already for the
replies/forwars.... I can only think of setting HTMLBody through the Outlook
objects model. But in this case you need to convert RTF to HTML. There is a dll
included with Outlook (rtfhtml.dll) which does it, but it is not documented by
MS because of the support concerns... Nice, isn't it?

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


Quote:
> 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.




- Show quoted text -

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

- Show quoted text -

Quote:
> > 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

- Show quoted text -

Quote:
> > 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.



Mon, 08 Nov 2004 02:12:26 GMT  
 RTF - inserting text - difficulties with RTF code stripped by Outlook
Oh dear.

I guess I could convert it as a workaround.  Or transfer the text to a
new message and send that as a workaround (ick!).  Anyway, as long as
it works.  Thanks for the extra idea.

I understand what you're saying conceptually, but I'm not able to
reconcile that with the fact that it works fine in a new message.
Would you say it's just some peculiar kind of bug?

I'm also very interested in that undocumented dll.  As the master of
all things undocumented by MS, Dmitry, would you be able to fill me in
on how does a person find out about this stuff.  Does someone just
trawl through the Outlook installation going "I wonder what this
does?".  Or does MS throw up a few hints?

Quote:

> So it looks like Outlook forgets that the body had been already saved and
> overwrites it again even if you have explicitly called Save already for the
> replies/forwars.... I can only think of setting HTMLBody through the Outlook
> objects model. But in this case you need to convert RTF to HTML. There is a dll
> included with Outlook (rtfhtml.dll) which does it, but it is not documented by
> MS because of the support concerns... Nice, isn't it?

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



> > 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.



Mon, 08 Nov 2004 05:13:36 GMT  
 RTF - inserting text - difficulties with RTF code stripped by Outlook
Yep, looks like a bug to me. I stumbled onto rtfhtml.dll by an accident; there
are several functions exported form that dll, the only mystery is the arguments.
I contacted somebody from MS about that dll, and the answer was that there is
really nothing secret there, but development does not want to document it
because they'll have to test and support it as a separate component...

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


Quote:
> Oh dear.

> I guess I could convert it as a workaround.  Or transfer the text to a
> new message and send that as a workaround (ick!).  Anyway, as long as
> it works.  Thanks for the extra idea.

> I understand what you're saying conceptually, but I'm not able to
> reconcile that with the fact that it works fine in a new message.
> Would you say it's just some peculiar kind of bug?

> I'm also very interested in that undocumented dll.  As the master of
> all things undocumented by MS, Dmitry, would you be able to fill me in
> on how does a person find out about this stuff.  Does someone just
> trawl through the Outlook installation going "I wonder what this
> does?".  Or does MS throw up a few hints?




- Show quoted text -

Quote:
> > So it looks like Outlook forgets that the body had been already saved and
> > overwrites it again even if you have explicitly called Save already for the
> > replies/forwars.... I can only think of setting HTMLBody through the Outlook
> > objects model. But in this case you need to convert RTF to HTML. There is a
dll
> > included with Outlook (rtfhtml.dll) which does it, but it is not documented
by
> > MS because of the support concerns... Nice, isn't it?

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



> > > 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.



Mon, 08 Nov 2004 05:40:30 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. picture format in rtf code (richtext/rtf control)

2. Append RTF-Text in a existent RTF-File

3. picture format in rtf code (richtext/rtf control)

4. Rich Text File (.RTF) -Can't copy multiple .rtf files

5. Rich Text File (.RTF) -Can't copy multiple .rtf files (VB 6.0 Enterprise)

6. Automate inserting RTF file as text

7. insert text in a rtf textfield

8. Inserting RTF codes into a RichTextBox

9. RTF Control - inserting hidden text

10. Rich TextBox - Inserting RTF Codes

11. BUG? Pasting RTF into word strips bookmarks

12. RTF codes in Rich Text Box

 

 
Powered by phpBB® Forum Software