View Single Post
  #2  
Old November 9th 06, 03:41 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Creating a new mailItem with a signature, and a modified HTMLBody

Try saving the Outlook MailItem before assigning it to a SafeMailItem and
see if that helps.

Why are you replacing a tag BODY ? Do you mean to replace all the text
between the start and end tags for body?

The signature block will be within the BODY /BODY tags, not outside it.

Open a new mail item with a signature block in it and save the new blank
message. Use a MAPI viewer such as OutlookSpy (www.dimastr.com) to look at
IMessage and then PR_HTML (or use code to access HTMLBody in the VBA project
and OK the security warning) and see what the HTML actually looks like.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Peter Reinhold" wrote in message
oups.com...
Hi All,

I am coding a OL2003 addin in C# using VS2005 and VSTO, and have my
core functionality working (a toolbar with a button, from which you are
able to create a new mailitem)

My problem is, I want to modify the HTMLBody of this new mailItem,
which I can, but this removes the signature.

If I try and use the HTMLBody from the created mail (after its been
shown, so it contains the signature), I get a security warning, which
is not acceptable for my end-users.

I've tried using Redemption, with the following code :

--
Outlook.MailItem newMail =
Outlook.MailItem)outlookApp.CreateItem(Outlook.OlI temType.olMailItem);
Redemption.SafeMailItem safeMail = new Redemption.SafeMailItem();

safeMail.Item = newMail;

newMail.HTMLBody = safeMail.HTMLBody.Replace("BODY", mailBody)
--

But, the safeMail.HTMLBody is just empty, it does not contain the
HTMLBody of the original mailItem.

Does anyone know either how to get the current users signature so I can
append it to my HTML mail, or, how to get Redemption to properly return
the HTMLBody of the original mailItem?


Kind Regards,
Peter


Ads