Click here to Skip to main content
15,917,875 members
Home / Discussions / C#
   

C#

 
GeneralRadio Button Pin
Aryan_Pushap8-Jun-05 21:25
Aryan_Pushap8-Jun-05 21:25 
QuestionHow to host vc+ control (.lib) in c# winform Pin
uhs8-Jun-05 21:23
uhs8-Jun-05 21:23 
AnswerRe: How to host vc+ control (.lib) in c# winform Pin
Carsten Zeumer8-Jun-05 23:22
Carsten Zeumer8-Jun-05 23:22 
GeneralFacing problem accessing cookies in MCMS 2002 Pin
pushpesh8-Jun-05 19:35
pushpesh8-Jun-05 19:35 
GeneralLate Binding With Excel Pin
ksanju10008-Jun-05 19:29
ksanju10008-Jun-05 19:29 
QuestionHow to avoid empty node to appear in xml file while doing xml serialization Pin
Shiby8-Jun-05 19:24
Shiby8-Jun-05 19:24 
AnswerRe: How to avoid empty node to appear in xml file while doing xml serialization Pin
leppie8-Jun-05 21:50
leppie8-Jun-05 21:50 
Generalstuck on a problem with outlook and c# Pin
ekynox8-Jun-05 18:38
ekynox8-Jun-05 18:38 
g'day guys,

i am stuck on a small problem which is starting to frustrate me a little. I have written a small c# application which displays a list of files. When a user selects one or more of the files it gets the selected files sends the file UNC path as hyper links to the email. The program itself invokes outlook to generate the emails.

If I were to simply use the generic outlook email editor (i.e. not ms word), it works fine. I have included a fragment of my code at the bottom.

The problem arises when outlook is configured to use ms word as the default email editor. There is no link being displayed in the body of the email. So I decided to write the content of the HTMLBody to console. What I found was that the link i am inserting using the <a> </a> tags is sitting out side the <html> & </html> tags.

To totally contridict my findings, I reverted the outlook email editor to Outlook's own editor (ie. not using ms word). I examined the contents of oMailItem.HTMLBody via console. My reference file enclosed in the <a> </a> tags was sitting outside the <html></html> tags. But the email itself showed the file as hyperlinks. I dont understand why this is possible!!!! Confused | :confused: Confused | :confused:

My question is how do I insert the reference file link within the <html></html> tags of the email body in c#??? At this point I am completely stumped. Confused | :confused: Is there a solution that can suit either types of email editors in outlook ????

Any suggestions ????

thanks

<code>
private void createEmail(object sender, System.EventArgs e)
{
string PostingNotice ="";
string EmailBody="";
string sHtml="";

oApp = new Outlook.Application();
oNameSpace= oApp.GetNamespace("MAPI");
oNameSpace.Logon(null,null,false,true);
oOutlookFolder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);

oMailItem.Display(false);

foreach (ListViewItem lvitem in listView3.Items)
{
int index = int.Parse(lvitem.Index.ToString());
string filename = selectedFileArrayList[index].ToString();
int lastindex = filename.LastIndexOf('\\');
string displayFilename = filename.Substring(lastindex+1, ((filename.Length) - (lastindex+1)));

//assume fileUNCPath as a string variable containing the UNC path of the file
sHtml = "<a href= "+"\""+fileUNCPath+"\">"+displayFilename+"</a>\n"+"<br>\n";

oMailItem.HTMLBody = sHtml + oMailItem.HTMLBody; //append file link to email body
}
oMailItem.Display(false);
}
</code>
GeneralRe: stuck on a problem with outlook and c# Pin
codeprojectin8-Jun-05 22:15
codeprojectin8-Jun-05 22:15 
GeneralRe: stuck on a problem with outlook and c# Pin
ekynox9-Jun-05 21:48
ekynox9-Jun-05 21:48 
GeneralC# - Using sender Pin
kezza65438-Jun-05 18:23
kezza65438-Jun-05 18:23 
GeneralRe: C# - Using sender Pin
Christian Graus8-Jun-05 18:29
protectorChristian Graus8-Jun-05 18:29 
GeneralRe: C# - Using sender Pin
kezza65438-Jun-05 19:26
kezza65438-Jun-05 19:26 
GeneralRe: C# - Using sender Pin
Philip Price8-Jun-05 23:24
Philip Price8-Jun-05 23:24 
QuestionHow to Close a Form when openning? Pin
Khoa Bui8-Jun-05 17:27
Khoa Bui8-Jun-05 17:27 
AnswerRe: How to Close a Form when openning? Pin
Christian Graus8-Jun-05 17:36
protectorChristian Graus8-Jun-05 17:36 
GeneralRe: How to Close a Form when openning? Pin
codeprojectin8-Jun-05 17:56
codeprojectin8-Jun-05 17:56 
GeneralRe: How to Close a Form when openning? Pin
Christian Graus8-Jun-05 18:30
protectorChristian Graus8-Jun-05 18:30 
GeneralRe: How to Close a Form when openning? Pin
Weiye Chen8-Jun-05 19:40
Weiye Chen8-Jun-05 19:40 
GeneralRe: How to Close a Form when openning? Pin
codeprojectin8-Jun-05 21:11
codeprojectin8-Jun-05 21:11 
GeneralRe: How to Close a Form when openning? Pin
Dave Kreskowiak9-Jun-05 8:30
mveDave Kreskowiak9-Jun-05 8:30 
GeneralI get a problem in calling C++ dll function in C# Pin
dinh van hai8-Jun-05 17:18
dinh van hai8-Jun-05 17:18 
GeneralRe: I get a problem in calling C++ dll function in C# Pin
Dave Kreskowiak9-Jun-05 8:32
mveDave Kreskowiak9-Jun-05 8:32 
GeneralRe: I get a problem in calling C++ dll function in C# Pin
dinh van hai9-Jun-05 15:37
dinh van hai9-Jun-05 15:37 
Generalconvert c/c++ header to c# Pin
savage_8-Jun-05 16:51
savage_8-Jun-05 16:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.