C
Chocks
Hi,
I am using Outlook object library(11.0) in my application for sending an
email. It works fine if I have one outlook profile on my local pc.
Q1. Once I send an email using a profile it remains even though I logoff
from Outlook namespace. The only way to get a different profile is to quit
the application and start again. Is there any timeout limit for the logoff?
Q2. If I have more than one outlook profiles and every time tries to logon
using a different profile it prompts for a login except for the default
profile. Am I missing something while setting up a profile?
Code***************************
strProfile = "Outlook"; //profile changes according to source
Outlook.Application oApp;
oApp = new Outlook.Application();
Outlook.NameSpace oNasp = oApp.GetNamespace("MAPI");
oNasp.Logon(strProfile, Missing.Value, true, true);
Outlook.MailItem oMail =
(Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMail.To = EmailTo;
oMail.Subject = EmailSubject;
oMail.Body = EmailMessage;
oMail.Send();
oNasp.Logoff();
oApp.Quit();
oNasp = null;
oMail = null;
oApp = null;
****************
Thanks
Chocks
I am using Outlook object library(11.0) in my application for sending an
email. It works fine if I have one outlook profile on my local pc.
Q1. Once I send an email using a profile it remains even though I logoff
from Outlook namespace. The only way to get a different profile is to quit
the application and start again. Is there any timeout limit for the logoff?
Q2. If I have more than one outlook profiles and every time tries to logon
using a different profile it prompts for a login except for the default
profile. Am I missing something while setting up a profile?
Code***************************
strProfile = "Outlook"; //profile changes according to source
Outlook.Application oApp;
oApp = new Outlook.Application();
Outlook.NameSpace oNasp = oApp.GetNamespace("MAPI");
oNasp.Logon(strProfile, Missing.Value, true, true);
Outlook.MailItem oMail =
(Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMail.To = EmailTo;
oMail.Subject = EmailSubject;
oMail.Body = EmailMessage;
oMail.Send();
oNasp.Logoff();
oApp.Quit();
oNasp = null;
oMail = null;
oApp = null;
****************
Thanks
Chocks