//namespace (add Microsoft.Office.Interop.Outlook.dll)
using Outlook = Microsoft.Office.Interop.Outlook;
//C# code : will create new mail message using predefined template
private void CreateNewMessageUsingTemplate() { Outlook.Folder folder = Application.Session.GetDefaultFolder(
Outlook.OlDefaultFolders.olFolderDrafts) as Outlook.Folder; Outlook.MailItem mail = Application.CreateItemFromTemplate( @"c:\templageName.oft", folder) as Outlook.MailItem; mail.Subject = "Using Template"; mail.Save(); }
//C# code : will create new mail message using predefined template
Private Sub CreateNewMessageUsingTemplate()
Dim folder As Outlook.Folder = _
CType(Application.Session.GetDefaultFolder( _
Outlook.OlDefaultFolders.olFolderDrafts), Outlook.Folder)
Dim mail As Outlook.MailItem = _
CType(Application.CreateItemFromTemplate( _
"c:\templateName.oft", folder), Outlook.MailItem)
mail.Subject = "Using Template"
mail.Save()
End Sub
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......