don't want to display in sentitems

Status
Not open for further replies.
H

hemaneelagiri

hi i am able to send mails from outlook through C#, but in some conditions i

don't want to save in sent items and some times i want to display in sent

items

below is my code

// Create the Outlook application.

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

// Get the NameSpace and Logon information.

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

// Log on by using a dialog box to choose the profile.

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

// Create a new mail item.

Outlook._MailItem oMsg = (Outlook.MailItem)oApp.CreateItem

(Outlook.OlItemType.olMailItem);

// Set the subject.

oMsg.Subject = strSubject;

oMsg.Body = strMessage;

if (iPriority == (int)Enums.Priority.High)

oMsg.Importance = Microsoft.Office.Interop.Outlook.

OlImportance.olImportanceHigh;

else if (iPriority == (int)Enums.Priority.Normal)

oMsg.Importance = Microsoft.Office.Interop.Outlook.

OlImportance.olImportanceNormal;

else if (iPriority == (int)Enums.Priority.Low)

oMsg.Importance = Microsoft.Office.Interop.Outlook.

OlImportance.olImportanceLow;

if (strToIds != "")

{

oMsg.To = strToIds;

if (bIsSaveMessage)

oMsg.Save();

oMsg.Send();

}

oNS.Logoff();

oMsg = null;

oNS = null;

oApp = null;

please help me


 
K

Ken Slovak - [MVP - Outlook]

If you don't want a copy of the sent item kept at all under those

circumstances just set the DeleteAfterSubmit property to true on the item

before sending it.

"hemaneelagiri " <u54138@uwe> wrote in message

news:9ce11e1aaafd3@uwe...
> hi i am able to send mails from outlook through C#, but in some conditions
> i
> don't want to save in sent items and some times i want to display in sent
> items
> below is my code

> // Create the Outlook application.
> Outlook._Application oApp = new Outlook.Application();

> // Get the NameSpace and Logon information.
> Outlook.NameSpace oNS = oApp.GetNamespace("mapi");

> // Log on by using a dialog box to choose the profile.
> oNS.Logon(Missing.Value, Missing.Value, false, true);

> // Create a new mail item.
> Outlook._MailItem oMsg = (Outlook.MailItem)oApp.CreateItem
> (Outlook.OlItemType.olMailItem);

> // Set the subject.
> oMsg.Subject = strSubject;

> oMsg.Body = strMessage;

> if (iPriority == (int)Enums.Priority.High)
> oMsg.Importance = Microsoft.Office.Interop.Outlook.
> OlImportance.olImportanceHigh;
> else if (iPriority == (int)Enums.Priority.Normal)
> oMsg.Importance = Microsoft.Office.Interop.Outlook.
> OlImportance.olImportanceNormal;
> else if (iPriority == (int)Enums.Priority.Low)
> oMsg.Importance = Microsoft.Office.Interop.Outlook.
> OlImportance.olImportanceLow;

> if (strToIds != "")
> {
> oMsg.To = strToIds;

> if (bIsSaveMessage)
> oMsg.Save();

> oMsg.Send();
> }
> oNS.Logoff();

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

> please help me

> >
>
>
 
H

hemaneelagiri

Thanks for your reply
- wrote:
> If you don't want a copy of the sent item kept at all under those
> circumstances just set the DeleteAfterSubmit property to true on the item
> before sending it.
>
> > hi i am able to send mails from outlook through C#, but in some conditions
> > i

> [quoted text clipped - 46 lines]
>

>> please help me



 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Diane Poremsky Pictures don't display in Outlook messages New Slipstick.com Articles 4
T Form Fields don't display when message sent Outlook VBA and Custom Forms 1
climberman people don't understand what I'm asking Using Outlook 6
Horsepower Contacts added from iPhone don't show up in Outlook Using Outlook 2
C All Gmails don't show in Outlook 2019 Using Outlook 2
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
L Favorites don't update Using Outlook 1
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
N Outlook rules don't create a copy for bcc'ed emails Using Outlook 3
C Don't forward duplicate Using Outlook 0
E Don't want Inbox shown when login box is shown Using Outlook 1
Jennifer Murphy Equations don't comply with style setting to left justify Using Outlook 0
E you don't have permission to perform this action exchange 2016 Exchange Server Administration 0
B Outlook 2016: Can't delete default calendar but I don't use it Using Outlook 7
B IMAP folders don't update when Outlook 365 opens Using Outlook 0
O Don't need any add-ins at all? Using Outlook 2
wisedave Office 365 Outlook - Emails send but don't receive Using Outlook 12
D Mail accounts don't show up in navigation pane Using Outlook 1
C iCloud addresses don't show up in "Address Book" or "To:" Using Outlook 5
U Subdirectories in people don't show up in the address book Using Outlook 1
M some emails send from outbox, some don't Using Outlook 10
Lucas attachments in outlook don't open, when Icloud is connected Using Outlook 0
J Share calendar but don't share categories Exchange Server Administration 1
J Graphics in email don Using Outlook 0
M Outlook 2013 folders - don't want to synchronize with email provider's server Using Outlook 15
H URL's don't work in .oft file Using Outlook 1
D My replies don't show up in my inbox Using Outlook 1
J RSS feeds don't get any messages Using Outlook 4
J Contact groups don't sync properly Using Outlook 7
M Don't have permission to schedule meetings on behalf Using Outlook 1
A Send only, don't receive Using Outlook 1
D iPhone Alerts Don't Show Up in Outlook Using Outlook 2
mrje1 mailto links in browsers don't open up outlook email Using Outlook 2
P Replied-to email messages don't sync properly Using Outlook.com accounts in Outlook 3
B Item_Write = False don't prevent custom form from closing Using Outlook 1
J Don't want my Comcast mail going to Outlook Using Outlook 1
R Outlook 2010 Sent emails don't appear in the sent mail folder Using Outlook 9
J Custom Forms Don't Always Auto-Forward From Public Folder Using Outlook 0
G Import pst but Calendar and Contacts don't show. Using Outlook 12
D appointments on To Do Bar don't reflect the correct Calendar Using Outlook 3
B Synced Yahoo to Outlook but don't want to receive all old emails in Outlook? Using Outlook 6
C error message: 'you don't have permission to create an entry in this folder' Using Outlook 3
S Reminders don't pop up and stay hidden in background Using Outlook 7
Forum Admin Recurring Appointments that don't fit a pattern Outlook Wishlist 26
Q Completed details on form don't show on reply Outlook VBA and Custom Forms 1
R Capture Sender's Display name and Address Outlook VBA and Custom Forms 3
M Outlook 2010 How could I globally redesign an outlook template form/region/inspector template used to display mail lists or an individual mails? Outlook VBA and Custom Forms 0
Travis Lloyd Messages Won't Display In Outlook 2019 Home & Business Using Outlook 0
A Prepending Email Addrs with "Display Name <email>" Has Stopped Working Using Outlook 0
M In Outlook Calendar remove the buttons: 'Today' and '<' (Back a day) and '>' (Forward a day) that are below the Ribbon and above the calendar display. Using Outlook 0

Similar threads

Top