P
Pavel Celba
Hi experts,
I am trying to change the default Outlook account but it seems to be
readonly for new mail messages... Does somebody know the solution?
My code (Visual FoxPro):
oOutlook = CREATEOBJECT("Outlook.Application")
oNamespace = oOutlook.GetNameSpace("MAPI")
oNamespace.Logon()
loItem = oOutlook.CreateItem(0)
loitem.To = '(e-mail address removed)'
loitem.Body = "BODY"
*-- Here is the problem
loitem.SendUsingAccount = oOutlook.Session.Accounts.Item[2] && I am sure
this is valid POP3 account
*-- Account should be changed now BUT
? loitem.SendUsingAccount && Still returns null (it is not an object)
Note: If I would send the message now, it will use default account
*-- After issuing
loitem.Display
*-- and changing Account manually via UI everything works as it should -
means the SendUsingAccount property is no more Readonly and I can assign
different accounts via automation commands...
So, the question is: How to create mail item having the SendUsingAccount
property R/W using automation?
I'll test above code in VB.NET to avoid VFP interoperability problem.
TIA for answers!
Outlook version: 2007 SP2 (12.0.6514.5000)
OS version: Vista Business SP2
I am trying to change the default Outlook account but it seems to be
readonly for new mail messages... Does somebody know the solution?
My code (Visual FoxPro):
oOutlook = CREATEOBJECT("Outlook.Application")
oNamespace = oOutlook.GetNameSpace("MAPI")
oNamespace.Logon()
loItem = oOutlook.CreateItem(0)
loitem.To = '(e-mail address removed)'
loitem.Body = "BODY"
*-- Here is the problem
loitem.SendUsingAccount = oOutlook.Session.Accounts.Item[2] && I am sure
this is valid POP3 account
*-- Account should be changed now BUT
? loitem.SendUsingAccount && Still returns null (it is not an object)
Note: If I would send the message now, it will use default account
*-- After issuing
loitem.Display
*-- and changing Account manually via UI everything works as it should -
means the SendUsingAccount property is no more Readonly and I can assign
different accounts via automation commands...
So, the question is: How to create mail item having the SendUsingAccount
property R/W using automation?
I'll test above code in VB.NET to avoid VFP interoperability problem.
TIA for answers!
Outlook version: 2007 SP2 (12.0.6514.5000)
OS version: Vista Business SP2