By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,665 Members | 1,952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,665 IT Pros & Developers. It's quick & easy.

confused on outlook email editor issue in C#

P: n/a
VP
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;
}

Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.