H
hemaneelagiri via OfficeKB.com
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
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