A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

want to launch outlook with attachemnet for new mail with c# code



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old January 7th 10, 06:02 AM posted to microsoft.public.outlook.program_addins
hemaneelagiri via OfficeKB.com
external usenet poster
 
Posts: 22
Default want to launch outlook with attachemnet for new mail with c# code

Thanks for your response

you mean to say Crete item. i am able to create item.. but how can we launch
that created mail

please see below code

Outlook._Application oApp = new Outlook.Application();

Outlook.NameSpace oNS = oApp.GetNamespace("mapi");

oNS.Logon(Missing.Value, Missing.Value, false, true);

Outlook._MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemTy pe.
olMailItem);

oMsg.Subject = strSubject;

oMsg.Body = strMessage;

fi = new System.IO.FileInfo(arrAttachPaths[i]);
iPosition = (int)oMsg.Body.Length + 1;
oMsg.Attachments.Add(fi.FullName, iAttachType, iPosition, fi.Name);

oMsg.To = strToIds; // use rshoukldenetr the To Id

// send mail.. but here new mail should launch and user will enetr that to
email id

oMsg.Send();

oNS.Logoff();

oMsg = null;
oNS = null;
oApp = null;

please help me



Ken Slovak - [MVP - Outlook] wrote:
Some combinations of startup switches don't work together. You can test that
in the UI by starting Outlook using those switches.

In any case you are better off starting an Outlook session and using the
CreateItem() method to create the email and then you can use the object
model to set subject, attachments, recipients, etc.

hi
i want to lanuch outlook(default mail client) with an attachment

[quoted text clipped - 15 lines]

pelase help me


--
Message posted via http://www.officekb.com

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Possibility to color-code mail folders in Outlook SaSo Outlook - Installation 0 December 4th 09 01:05 AM
A code that adds category to an outgoing mail message in outlook newED Outlook and VBA 7 August 3rd 09 07:50 PM
Possibility to color-code mail folders in Outlook glennn.php Outlook - Installation 5 February 15th 09 09:51 AM
how can I set a pass code to my outlook so only I can open mail MR.LEE[_2_] Outlook - General Queries 1 December 17th 08 04:14 AM
Outlook2003 failing to launch after first launch njmeatball Outlook - Installation 4 October 25th 06 10:29 PM


All times are GMT +1. The time now is 01:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.