Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook Automation - Can't set mail.SendUsingAccount
Message
From
05/02/2017 21:34:47
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Outlook Automation - Can't set mail.SendUsingAccount
Miscellaneous
Thread ID:
01647559
Message ID:
01647559
Views:
167
I'm copying the code below from an old Blog, but it describes the issue exactly. Setting loItem.SendUsingAccount was working fine until recently. Most likely a recent update to Outlook 365 or 2016 seems to have broke it. Is anyone else able to set loItem.SendUsingAccount property successfully, as in the following example? Or does anyone have a solution to make it work? TIA!
oOutlook = CREATEOBJECT("Outlook.Application")
oNamespace = oOutlook.GetNameSpace("MAPI")
oNamespace.Logon()
loItem = oOutlook.CreateItem(0)
loitem.To = '***@email.com'
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 in VFP?

Similar code works fine in VB.NET, so it seems to be purely VFP - Outlook
interoperability problem.
Next
Reply
Map
View

Click here to load this message in the networking platform