Connecting Tech Pros Worldwide Help | Site Map

confused on outlook email editor issue in C#

VP
Guest
 
Posts: n/a
#1: Nov 17 '05
g'day,

i am posting a problem i have encountered with creating an email using
outlook through some basic c# code. the problem arises when using
different email editors in outlook. At the moment i am using outlook
2000. Outlook can be configured to use the default outlook email editor
or use ms word as the email editor in outlook.

The sample code below simply creates an email with a hyperlink. The
problem I am facing is that when outlook is configured to us ms word as
the email editor, the email created doesnt show the hyperlink. When the
email editor is switched over to the outlook email editor the
hyperlinks show up.

My question is that why does this happen ??? Is this fallacy on Outlook
side or am i misunderstanding something here??

If anyone can correct me I would really appreciate it.

thanks
Vee

private void CreateEmail()
{
string sHtml = "";
string signature = "";

Outlook.Application oApp;
Outlook._NameSpace oNameSpace;
Outlook.MAPIFolder oOutlookFolder;
oApp = new Outlook.Application();
oNameSpace= oApp.GetNamespace("MAPI");
oNameSpace.Logon(null,null,false,true);
oOutlookFolder =
oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolde rs.olFolderSentMail);
Outlook._MailItem oMailItem =
(Outlook._MailItem)oApp.CreateItem(Outlook.OlItemT ype.olMailItem);

//display the blank email first so that the signature can be retained
oMailItem.Display(false);

//extract the signature from the HTMLBODY
signature = oMailItem.HTMLBody;

//create a hyperlink
sHtml += "<a href=
"+"\""+"http://www.google.com"+"\">"+"google"+"</a>\n"+"<br>\n";

//clear the email body
oMailItem.Body="";
//append the hyperlink to the email body
oMailItem.Body+=sHtml;
//append the email body and signature to the html body of the email
oMailItem.HTMLBody=oMailItem.Body+signature;
}

Closed Thread