Answered by:
How to Add custom HTML Template to outlook appointment body????

Question
-
Hi,
I'm using VS2008 with C# and here is my question:::
I need develop an Outlook Add-in, the functionality of this Add-in is to add a HTML Template while creating Appointments or Meeting Requests etc.. where the user can open tables or unordered list easily by selecting options provided just like word functionality.
and the should support all three versions of outlook 2003-2010.
What's the best way to approach this problem?
Urgent!!!!!!!
Thanks..
Monday, November 8, 2010 12:28 PM
Answers
-
Look at Ron's sendmail example.
http://www.rondebruin.nl/sendmail.htm
In the example below (http://www.rondebruin.nl/mail/folder3/mail2.htm)
the file is saved as an HTM and then read into the email object. Depedning on the version of Outlook the solution may be different. See all of Ron's examples.
'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With
'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.ReadAll
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _
"align=left x:publishsource=")
'Close TempWB
TempWB.Close savechanges:=False
jdweng- Marked as answer by Bessie Zhao Monday, November 15, 2010 9:24 AM
Tuesday, November 9, 2010 11:43 AM
All replies
-
You should discuss this issue with Ron DeBruin. Below is his webpage with VBA email tips and plenty of examples. You can also email him at his website for more information. Ron is a member of this forum and will probably respond to this email himself.
Ths code examples worj with excel but can be modifiedto work easily with Visual Studio.
http://www.rondebruin.nl/mail/add-in.htm
jdwengMonday, November 8, 2010 3:22 PM -
Hi,
Is a very open and wide question, I'll try to answer the whole thing:
1) With Visual Studio 2008, C# and VSTO you can create an Outlook 2003 and 2007 add-in. This add-in also will work with 2010 without issues (One of my add-ins is doing so).
2) I recommend you to use the Ribbon Visual Designer to add the ribbon into the Appointment Inspector.
3) For adding html into the body of the item, use the Word interop API instead of modifying the body with Item.Body. Is much better and powerful. I used it to append a HTML signature in all items before sending.
Let me know if you need further info.
Regards,
Mauro.
castagnasso.wordpress.comMonday, November 8, 2010 4:55 PM -
Thank you very much, Yes I would like to know further more information relating to Word interop API with full step by step functionality or methods related to it. Please give response as soon as possible because its urgent.
Regards,
Venkateswari
Tuesday, November 9, 2010 11:34 AM -
Look at Ron's sendmail example.
http://www.rondebruin.nl/sendmail.htm
In the example below (http://www.rondebruin.nl/mail/folder3/mail2.htm)
the file is saved as an HTM and then read into the email object. Depedning on the version of Outlook the solution may be different. See all of Ron's examples.
'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With
'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.ReadAll
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _
"align=left x:publishsource=")
'Close TempWB
TempWB.Close savechanges:=False
jdweng- Marked as answer by Bessie Zhao Monday, November 15, 2010 9:24 AM
Tuesday, November 9, 2010 11:43 AM