![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]()
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 |
#3
|
|||
|
|||
![]() 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 |
#4
|
|||
|
|||
![]()
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 |
#5
|
|||
|
|||
![]()
To save an Item use Item.Save. Until you do that the HTML properties aren't
populated. I'll try this, thanks 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. Ofcourse, but, the string i'm replacing with starts with BODY ![]() 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. This is some nice info, i'll check the registry to see if I can find anything there, but at least i'll be able to get the signature, if the first method doesn't work. |
#6
|
|||
|
|||
![]()
Plain Text for every existing signature. I don't know offhand where the
setting for the default signature is stored, probably somewhere in the This is some nice info, i'll check the registry to see if I can find anything there, but at least i'll be able to get the signature, if the I found the key, its not exactly logical, but here it is HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A001 04B2A6676\00000003 Now i'll be able to get the current default signature, and actually read the signature from disk ![]() /Peter |
#7
|
|||
|
|||
![]()
Actually, that does sound logical, although it's not the first place I'd
think of looking. The default signature settings are being stored on a per Outlook profile basis. -- 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... Plain Text for every existing signature. I don't know offhand where the setting for the default signature is stored, probably somewhere in the This is some nice info, i'll check the registry to see if I can find anything there, but at least i'll be able to get the signature, if the I found the key, its not exactly logical, but here it is HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A001 04B2A6676\00000003 Now i'll be able to get the current default signature, and actually read the signature from disk ![]() /Peter |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with signature when creating new email | John | Outlook - General Queries | 1 | September 21st 06 05:57 PM |
Problem with signature when creating new email | John | Outlook and VBA | 1 | September 21st 06 05:57 PM |
problems creating proper formatting in signature | sat | Outlook - General Queries | 5 | July 31st 06 02:55 AM |
Creating an Outlook MailItem when Outlook hasn't been opened | WhytheQ | Outlook and VBA | 1 | May 10th 06 11:41 PM |
Having trouble creating a signature that includes a logo | Nicole | Outlook - Installation | 0 | March 7th 06 05:11 PM |