1. Hari KrishnaBolla
  2. PowerBuilder
  3. Monday, 8 March 2021 12:55 PM UTC

Hello,

 

I am from the IT department of my company Sedgwick. We seeking some technical support.

 

Situation:

One of our business application is written in Power Builder 12.5 runs in an exclusive Remote Desktop environment. It makes calls to Outlook 2010 to send emails, open email objects etc. This is a important feature of the application. We are in the process of migrating from Outlook 2010 to Outlook 2016.

 

In this situation we are planning to move from Outlook 2010 to Outlook 2016, currently testing. When our application tries to connect to Outlook 2016, application does not able to connect to outlook and its crashing.

 

Please can you help in fixing this problem.

 

 

The below code is being used to connect to outlook account and while executing line “lmrc_ret = maillogon(mailNewSession!)”, application is crashing.

 

 

 

mailReturnCode lmrc_ret

string ls_prof, ls_msg

long ll_ret

ll_ret = SecurityManager.ConnectToNewObject("AddInExpress.OutlookSecurityManager")

if ll_ret < 0 then

         gnv_app.cmessagebox('n_emailsession',gnv_app.is_displayname,"Unable to Clear Outlook Security")

              return false

end if

 

RegistryGet ( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles", "DefaultProfile", RegString!,ls_prof)

yield()

ib_loggedon = false

//lmrc_ret = maillogon(ls_prof,"",mailnewsession!)

lmrc_ret = maillogon(mailNewSession!)

yield()

Choose Case lmrc_ret

              Case mailReturnSuccess!

                             ib_loggedon = true

              Case mailReturnLoginFailure!

                             ls_msg = "Login Failure"

              Case mailReturnInsufficientMemory!

                             ls_msg = "Login Failure"

              Case mailReturnTooManySessions!

                             ls_msg = "Too Many Sessions"

              Case mailReturnUserAbort!

                             ls_msg = "User Abort"

              Case Else

                             ls_msg = "Unspecified Error"

End Choose

if not ib_loggedon then

            gnv_app.cmessagebox('n_emailsession',gnv_app.is_displayname,"Email ||"+ls_msg)

end if

 

return ib_loggedon

 

 

Regards,

Harikrishna

mike S Accepted Answer Pending Moderation
  1. Monday, 8 March 2021 14:45 PM UTC
  2. PowerBuilder
  3. # 1

You should change over to using OLE to process outlook email, rather than the PB mapi functions.  My only regret in doing that for my application was that i waited so long to do it.  Works so much better and we don't have these sorts of problems when using different outlook versions.

 

 

Comment
There are no comments made yet.
Hari KrishnaBolla Accepted Answer Pending Moderation
  1. Tuesday, 9 March 2021 09:52 AM UTC
  2. PowerBuilder
  3. # 2

Hi Mike,

Thank you for the response.

if it is possible, could you please share sample code for reference.

Regards,

Harikrishna

Comment
  1. mike S
  2. Tuesday, 9 March 2021 14:02 PM UTC
use the microsoft documentation for the full list of available features.

-----------------------------



//CONNECT

iole_outlook = create OLEObject

li_session = iole_outlook.ConnectToObject("","outlook.application")

IF li_session <> 0 THEN

li_session = iole_outlook.ConnectToNewObject("outlook.application")



If li_session <> 0 Then

is_LastError = "Error: Creating new Outlook session "

destroy iole_outlook

return -1

end if

END IF



iole_item = iole_outlook.CreateItem(0)





////build out recipient list

iole_item.To = ls_Emailaddresss



//some sort of minimum # chars in the body; less than that and it won't send. So add a bunch of spaces rather than just one.

if isnull(as_messagebody) or as_messagebody = '' then as_messagebody = ' '



iole_item.Subject = as_subject

iole_item.BodyFormat = this.formatplain

iole_item.Body = as_messagebody



iole_item.Send //sends the message

li_rc = iole_outlook.DisconnectObject()

destroy iole_item

destroy iole_outlook
  1. Helpful
  1. Hari KrishnaBolla
  2. Friday, 19 March 2021 11:57 AM UTC
its Working.

Thanks Mike.

  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Friday, 19 March 2021 12:31 PM UTC
  2. PowerBuilder
  3. # 3

PowerBuilder 12.5 apps are 32bit so make sure you are using 32bit Outlook.

Comment
  1. Chris Pollach @Appeon
  2. Friday, 19 March 2021 19:04 PM UTC
Hi Miguel ... only of the Office "Client" installed is 32bit. For 64bit Outlook client installs, you would need to create a 64bit PB App EXE.
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 19 March 2021 21:45 PM UTC
Hi Chris, I'm not sure I understand what you mean with "Office client". We have a lot of customers who install office 64 bit on their pc and our 32 bit powerbuilder application using OLE works just fine ..

regards
  1. Helpful
  1. mike S
  2. Saturday, 20 March 2021 14:51 PM UTC
yes, ole allows you independence of bitness, another big reason to not use mapi anymore
  1. Helpful
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.