1. Miguel Leeuwee
  2. PowerBuilder
  3. Monday, 29 January 2018 08:40 AM UTC

Hi just to comment on the bug mentioned in the title: (HIH).

We have the same problem with PB12.6. Not sure if the user is using MAPI or OLE, but for both we solved this problem by "flushing". Since to do so you have to use OLE, MAPI has been discarded by us, except for showing an address list.

The code that does that:

safeoRecip = oleNameSpace.SyncObjects.Item(1)
------------------- piece of code in which it's being used after the send of the email ----------------------------------------
// trident2, mjl, 11/11/15: flush was missing
if NOT isValid(oleNameSpace) then
if isvalid(safeOutlook_app) then
destroy safeOutlook_app
end if
safeoutlook_app = create oleobject
if safeoutlook_app.ConnectToNewObject("outlook.application") < 0 then
Messagebox('Error', 'Cannot connect to outlook')
// T2, mjl, 19/11/2015: this will happen when having Outlook 2013 opened already and when NOT running the 
// executable of the application, with the exe everything goes fine, strangly enough.
return -1 
end if
oleNameSpace = safeoutlook_app.GetNameSpace('MAPI')
// oleNameSpace.Logon('', '', true, false)
oleNameSpace.Logon(gnv_app.is_defaultProfile, '', true, true)
end if
safeoRecip = oleNameSpace.SyncObjects.Item(1)
/// trident2, mjl, end.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 30 January 2023 12:09 PM UTC
  2. PowerBuilder
  3. # 1


There's a small sample application on https://community.appeon.com/index.php/qna/q-a/powerbuilder-outlook-topwiz-send-mail 

It has more up-to-date information about syncing.

Very important: You have to syn the outbox AFTER you have done the "send".


  1. Roland Smith
  2. Thursday, 2 February 2023 02:21 AM UTC
I added syncing to my example. It appears to work for me.

  1. Helpful 1
  1. Miguel Leeuwe
  2. Thursday, 2 February 2023 06:39 AM UTC

Yes, I've only seen it cause problems for some users who were using Citrix and there was also a time when it failed for the newer versions of Outlook.In that case, we used SendAndReceive instead of SyncObjects. A point worth noting is that many times I have had problems with this kind of stuff and then after some months (=a couple of Outlook updates) problems would disappear without having changed any of my code. Thinking back on Outlook 2013 and 2016. Outlook 365 seems to be a lot more stable.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 12 March 2019 15:04 PM UTC
  2. PowerBuilder
  3. # 2

If you were to use SMTP, your app communicates directly with the email server. The one downside is no cop in Sent Items folder. That can be overcome by doing a BCC to a mailbox that is accessible to whomever needs it or you can BCC to yourself and set up a rule in Outlook to move them to Sent Items automatically.



There are no comments made yet.
Govinda Lopez @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 31 January 2018 15:45 PM UTC
  2. PowerBuilder
  3. # 3

Hi Miguel,


Thank you very much for your comments. This seems very useful! I will recommend your post as a reference for further questions regarding this issue.




There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.