To know new message length

N

Nagaraj

Hi,

I opened already existing mail.I clicked Forward button. I entered some
valid email address in To field. Without entering anything I clicked Send
button.

My requirement is how to know that I didn't enter anything.
i.e I want to know the length of newly entered text which is 0.

How to calculate this value?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

Get the length of the Body and/or HTMLBody properties when the item opens,
get it again when the Send() event fires. Compare the 2 values.
 
N

Nagaraj

Thank you Ken for your reply.

My requirement is when I open an existing mail item and click Forward
button, it will automatically add 2 blank lines. So when I calculate the
difference between those two values it is even counting blank characters also.

I declared one variable originalMessage and assigned it a value in the
mail_Forward event as follows


originalMessage = forwardMail.HTMLBody;

In the Item_Send event I am calculating legth as follows

length = mailItem.HTMLBody.Trim()Length - originalMessage.Trim().Length



where length is coming as 1537

I want to validate new message length to be 0 since I didn't enter any new
characters. How to do this in c#

Thanks
 
K

Ken Slovak - [MVP - Outlook]

I don't understand your issue. Add the 2 lines, then calculate the length,
then do what you're doing in Send() and get the difference. The code you
show should work,
 

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