Click here to Skip to main content
15,914,225 members
Home / Discussions / C#
   

C#

 
AnswerRe: delegate Pin
Colin Angus Mackay17-Dec-05 23:44
Colin Angus Mackay17-Dec-05 23:44 
QuestionEmail via Outlook ? Pin
Christian Graus17-Dec-05 21:56
protectorChristian Graus17-Dec-05 21:56 
AnswerRe: Email via Outlook ? Pin
S. Senthil Kumar18-Dec-05 2:07
S. Senthil Kumar18-Dec-05 2:07 
GeneralRe: Email via Outlook ? Pin
ekynox18-Dec-05 9:33
ekynox18-Dec-05 9:33 
AnswerRe: Email via Outlook ? Pin
Michael P Butler18-Dec-05 3:12
Michael P Butler18-Dec-05 3:12 
AnswerRe: Email via Outlook ? Pin
Kevin McFarlane18-Dec-05 5:26
Kevin McFarlane18-Dec-05 5:26 
AnswerRe: Email via Outlook ? Pin
mav.northwind18-Dec-05 8:59
mav.northwind18-Dec-05 8:59 
GeneralRe: Email via Outlook ? Pin
ekynox18-Dec-05 11:33
ekynox18-Dec-05 11:33 
Here is the source code that i had used to send an email with attachments via Outlook(minimum version is 2000)

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.OlDefaultFolders.olFolderSentMail);
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
Outlook.Inspector myinspector;
myinspector = oApp.ActiveInspector();

oMailItem.Display(false); //display the blank email first
oMailItem.Subject = "Email with Attachments";

//filename is a string which represents the filepath of the file
//display_filename is a string which is the actual filename of the attachment
oMailItem.Attachments.Add(filename,1,1,display_filename);

oMailItem.Display(true); //display the email with the actual attachment.

To determine different versions of outlook you can try the version Method from the Outlook Object model as follows:

Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
string outlookVersion = oApp.Version;


I hope this helps.
cheers

-- modified at 17:34 Sunday 18th December, 2005
edit: The code in this sample will work with Outlook Object models 9.0,10.0 and 11.0.
GeneralRe: Email via Outlook ? Pin
Christian Graus20-Dec-05 16:21
protectorChristian Graus20-Dec-05 16:21 
GeneralRe: Email via Outlook ? Pin
ekynox21-Dec-05 1:43
ekynox21-Dec-05 1:43 
AnswerRe: Email via Outlook ? Pin
Scott Serl19-Dec-05 7:19
Scott Serl19-Dec-05 7:19 
QuestionHow to activate F1 to F12 keys Pin
ayuba asia17-Dec-05 15:49
ayuba asia17-Dec-05 15:49 
AnswerRe: How to activate F1 to F12 keys Pin
ekynox17-Dec-05 19:34
ekynox17-Dec-05 19:34 
AnswerRe: How to activate F1 to F12 keys Pin
leppie17-Dec-05 21:50
leppie17-Dec-05 21:50 
GeneralRe: How to activate F1 to F12 keys Pin
ayuba asia18-Dec-05 15:02
ayuba asia18-Dec-05 15:02 
QuestionSendMessage stops my App Pin
sirlantis17-Dec-05 14:27
sirlantis17-Dec-05 14:27 
AnswerRe: SendMessage stops my App Pin
Jared Parsons17-Dec-05 20:36
Jared Parsons17-Dec-05 20:36 
QuestionSystem.ManagementObjectSearcher ' s constructor by sql clause... Pin
Developer_117-Dec-05 13:53
Developer_117-Dec-05 13:53 
AnswerRe: System.ManagementObjectSearcher ' s constructor by sql clause... Pin
Dave Kreskowiak17-Dec-05 17:36
mveDave Kreskowiak17-Dec-05 17:36 
QuestionMemory management - Free a process's memory Pin
orenmh17-Dec-05 13:29
orenmh17-Dec-05 13:29 
AnswerRe: Memory management - Free a process's memory Pin
Colin Angus Mackay17-Dec-05 14:20
Colin Angus Mackay17-Dec-05 14:20 
QuestionBit fields in C# Pin
Drot17-Dec-05 7:56
Drot17-Dec-05 7:56 
AnswerRe: Bit fields in C# Pin
Jared Parsons17-Dec-05 10:51
Jared Parsons17-Dec-05 10:51 
AnswerRe: Bit fields in C# Pin
leppie17-Dec-05 21:56
leppie17-Dec-05 21:56 
AnswerRe: Bit fields in C# Pin
tarasn19-Dec-05 23:24
tarasn19-Dec-05 23:24 

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.