A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

mailItem.HTMLBody should retrieve only current text



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 23rd 09, 10:57 AM posted to microsoft.public.outlook.program_addins
Nagaraj
external usenet poster
 
Posts: 22
Default mailItem.HTMLBody should retrieve only current text

while replying to messages, when I use mailItem.HTMLBody I am getting entire
body including previous messages. I want to get only current entered new text
but not previous messages. Can anyone know how to do it in C#



--
Nagaraj Tadipatri
Ads
  #2  
Old February 23rd 09, 02:33 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default mailItem.HTMLBody should retrieve only current text

Get the previous message that's being replied to and find the text between
the body and /body tags. Then get the current reply message and get the
same from there. Do a diff on the two and what's left is the new text.

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


"Nagaraj" wrote in message
...
while replying to messages, when I use mailItem.HTMLBody I am getting
entire
body including previous messages. I want to get only current entered new
text
but not previous messages. Can anyone know how to do it in C#



--
Nagaraj Tadipatri


  #3  
Old February 23rd 09, 04:47 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default mailItem.HTMLBody should retrieve only current text

What would happen if the user repling to a message makes edits to the
original message body?
I do it all the time.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Nagaraj" wrote in message
...
while replying to messages, when I use mailItem.HTMLBody I am getting
entire
body including previous messages. I want to get only current entered new
text
but not previous messages. Can anyone know how to do it in C#



--
Nagaraj Tadipatri



  #4  
Old February 24th 09, 05:40 AM posted to microsoft.public.outlook.program_addins
Nagaraj
external usenet poster
 
Posts: 22
Default mailItem.HTMLBody should retrieve only current text

Thank you Ken for your reply.

My actual requirement is I already have some message replied to me. Whenever
I reply back to him I want to display (company signature) immediately after
new text which i reply to him.

But what is happening is the signature is displayed after entire text
(current text and previous message).

My current code
mailItem.HTMLBody = mailItem.HTMLBody + adContent.text;

where adContent.text is the company signature.

My requirement is i want to display company signature immediately after my
reply text but not at end of entire message( current + previous messages). Do
you have any C# code to do this?

Thanks
is

--
Nagaraj Tadipatri


"Ken Slovak - [MVP - Outlook]" wrote:

Get the previous message that's being replied to and find the text between
the body and /body tags. Then get the current reply message and get the
same from there. Do a diff on the two and what's left is the new text.

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


"Nagaraj" wrote in message
...
while replying to messages, when I use mailItem.HTMLBody I am getting
entire
body including previous messages. I want to get only current entered new
text
but not previous messages. Can anyone know how to do it in C#



--
Nagaraj Tadipatri



  #5  
Old February 24th 09, 03:34 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default mailItem.HTMLBody should retrieve only current text

You will have to do what I said, any code I have for something like that is
so customized for specific clients it wouldn't do you much good. Find the
original text within the body /body tags and the new text in the reply
message and find where the new text was added to the old text. You might
also have to parse the text to remove any existing signatures if they are
present in the text.

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


"Nagaraj" wrote in message
...
Thank you Ken for your reply.

My actual requirement is I already have some message replied to me.
Whenever
I reply back to him I want to display (company signature) immediately
after
new text which i reply to him.

But what is happening is the signature is displayed after entire text
(current text and previous message).

My current code
mailItem.HTMLBody = mailItem.HTMLBody + adContent.text;

where adContent.text is the company signature.

My requirement is i want to display company signature immediately after my
reply text but not at end of entire message( current + previous messages).
Do
you have any C# code to do this?

Thanks
is

--
Nagaraj Tadipatri


  #6  
Old March 10th 09, 06:34 AM posted to microsoft.public.outlook.program_addins
Nagaraj
external usenet poster
 
Posts: 22
Default mailItem.HTMLBody should retrieve only current text

Hello Ken,

I have the following text in the original text within the body


divplease see below. i will send another one where its coming on top of
the email./divdivbr/divdivraghu/divdiv style="font-family:times
new roman, new york, times, serif;font-size:12pt"brdiv
style="font-family:times new roman, new york, times,
serif;font-size:12pt"font size="2" face="Tahoma"----- Forwarded Message
----brbspan style="font-weight: bold;"From:/span/b Steve Waterhouse
brbspan style="font-weight:
bold;"To:/span/b brbspan style="font-weight:
bold;"Sent:/span/b Thursday, March 5, 2009 3:22:01 PMbrbspan
style="font-weight: bold;"Subject:/span/b FW: testbr/fontbr



new text message contains


div class=Section1

p class=MsoNormalspan
style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'fwdo/o/span/p

p class=MsoNormalspan
style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'o /o/span/p

div

div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in
0in'

p class=MsoNormalbspan
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'From:/span/bspan
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"' sridhar
] br
bSent:/b Friday, March 06, 2009 2:36 AMbr
bTo:/b Nagarajbr
bCc:/b Vikram Rayabharibr
bSubject:/b Fw: testo/o/span/p

/div

/div

p class=MsoNormalo /o/p

div

div

p class=MsoNormalplease see below. i will send another one where its coming
on top of the email.o/o/p

/div

div

p class=MsoNormalo /o/p

/div


My problem is I am unable to search the text in the original text

divplease see below. i will send another one where

in the new message text because in the new text p class=MsoNormal tag is
attached to the modified text as follows

div

p class=MsoNormalplease see below. i will send another one where its coming


Can you suggest me how to get the index of 'please see below' in the new
message text


Thanks





Nagaraj Tadipatri


"Ken Slovak - [MVP - Outlook]" wrote:

You will have to do what I said, any code I have for something like that is
so customized for specific clients it wouldn't do you much good. Find the
original text within the body /body tags and the new text in the reply
message and find where the new text was added to the old text. You might
also have to parse the text to remove any existing signatures if they are
present in the text.

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


"Nagaraj" wrote in message
...
Thank you Ken for your reply.

My actual requirement is I already have some message replied to me.
Whenever
I reply back to him I want to display (company signature) immediately
after
new text which i reply to him.

But what is happening is the signature is displayed after entire text
(current text and previous message).

My current code
mailItem.HTMLBody = mailItem.HTMLBody + adContent.text;

where adContent.text is the company signature.

My requirement is i want to display company signature immediately after my
reply text but not at end of entire message( current + previous messages).
Do
you have any C# code to do this?

Thanks
is

--
Nagaraj Tadipatri



  #7  
Old March 10th 09, 01:21 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default mailItem.HTMLBody should retrieve only current text

If you are specifically looking for "please see below" then it's easy to
find that text.

Outlook will rewrite your HTML, and how it's rewritten depends also on what
email editor is being used. If necessary you have to experiment with that
and possibly set up different tests depending on whether or not WordMail is
being used and what version of Outlook the code is running on.

One trick you can use is to get the text without all the HTML tags by
reading the Body property to get the plain text equivalent. That makes it
easier to find the end of the previous message, once you have that you can
search for the equivalent text in the HTMLBody. Then you apply logic that
starts at that position and works backwards or forward to find the enclosing
tags for that section.

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


"Nagaraj" wrote in message
...
Hello Ken,

I have the following text in the original text within the body


divplease see below. i will send another one where its coming on top of
the email./divdivbr/divdivraghu/divdiv
style="font-family:times
new roman, new york, times, serif;font-size:12pt"brdiv
style="font-family:times new roman, new york, times,
serif;font-size:12pt"font size="2" face="Tahoma"----- Forwarded Message
----brbspan style="font-weight: bold;"From:/span/b Steve
Waterhouse
brbspan style="font-weight:
bold;"To:/span/b brbspan style="font-weight:
bold;"Sent:/span/b Thursday, March 5, 2009 3:22:01 PMbrbspan
style="font-weight: bold;"Subject:/span/b FW: testbr/fontbr



new text message contains


div class=Section1

p class=MsoNormalspan
style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'fwdo/o/span/p

p class=MsoNormalspan
style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'o /o/span/p

div

div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in
0in
0in'

p class=MsoNormalbspan
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'From:/span/bspan
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"' sridhar
] br
bSent:/b Friday, March 06, 2009 2:36 AMbr
bTo:/b Nagarajbr
bCc:/b Vikram Rayabharibr
bSubject:/b Fw: testo/o/span/p

/div

/div

p class=MsoNormalo /o/p

div

div

p class=MsoNormalplease see below. i will send another one where its
coming
on top of the email.o/o/p

/div

div

p class=MsoNormalo /o/p

/div


My problem is I am unable to search the text in the original text

divplease see below. i will send another one where

in the new message text because in the new text p class=MsoNormal tag is
attached to the modified text as follows

div

p class=MsoNormalplease see below. i will send another one where its
coming


Can you suggest me how to get the index of 'please see below' in the new
message text


Thanks


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing Active/Current/Selected MailItem MJS Outlook and VBA 1 January 14th 07 08:51 AM
HTMLBody Property of Outlook MailItem Judy Outlook - Using Forms 1 December 27th 06 01:46 AM
Creating a new mailItem with a signature, and a modified HTMLBody Peter Reinhold Add-ins for Outlook 6 November 10th 06 03:52 PM
extracting mailitem.body text to Excel columns Junoon Outlook and VBA 3 April 20th 06 05:45 AM
Retrieve current item on TaskPad in Calender Michael Bauer Outlook and VBA 0 January 9th 06 08:04 AM


All times are GMT +1. The time now is 09:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright Đ2004-2025 Outlook Banter.
The comments are property of their posters.