View Single Post
  #4  
Old November 9th 06, 09:12 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

To save an Item use Item.Save. Until you do that the HTML properties aren't
populated.

If you've looked at the HTML then you know that replacing the tag BODY
will do nothing for you, all it would do is replace that tag with whatever
you're adding. It would leave a hanging /BODY tag there. And with the
signature inside the BODY /BODY tags you'll end up losing your signature
anyway since you're replacing things.

You can use HRGetOneProp from Extended MAPI, but that would still do you no
good until the Outlook item is saved. Until then MAPI doesn't have the
property you want populated.

Signatures in Outlook are stored at C:\Documents and Settings\windows
logon\Application Data\Microsoft\Signatures. There's one in HTML, RTF and
Plain Text for every existing signature. I don't know offhand where the
setting for the default signature is stored, probably somewhere in the
registry. Changing that while running regmon or some other registry monitor
would probably show you that.

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

Ken Slovak - [MVP - Outlook] skrev:
Try saving the Outlook MailItem before assigning it to a SafeMailItem and
see if that helps.


Saving it .. OK, will see if there's a function for that, or could you
explain what I would need to do? (Save it as a draft, or?)

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


I want to insert my pre-defined mail in the body, before the signature.

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.


PR_HTML .. Could I possibly use the GetHRProp (or what its called, I
haven't got the code in front of me right now), to get the HTML body?

I have seen what the HTML looks like with the signature in it .. If i
output (msgbox) the contents of HTMLBody after I have displayed the new
MailItem, I can get the HTML code out fine (by accepting the security
warning)

The problem is not the formatting of the mailbody, but actually getting
to the mailbody at all.

Is it possible to get the default signature via an addin?


/Peter


Ads