1. Vipul Prakash Srivastava
  2. PowerBuilder
  3. Thursday, 7 January 2021 06:05 AM UTC

Our PB code in 2017 R3 was migrated to windows 10 environment. mail functionality which was working on Win7 no longer works on Outlook 365 (Outlook for Office 365 MSO (16.0.10730.20155)).

We get Microsoft Outlook Error

"Login Failed"

Our code looks like this;

// Create a mail session
mSes = create mailSession

// Log on to the session
mRet = mSes.mailLogon("Default","")

IF mRet <> mailReturnSuccess! THEN
mRet = mSes.mailLogon(mailNewSession!)
IF mRet <> mailReturnSuccess! THEN
MessageBox("Mail", 'Logon failed.')
RETURN
END IF
END IF

 Things tried:

Outlook is open all the time

I tried setting Outlook as default through settings,

Added  [PB]
UseSimpleMAPI=yes

to pb.ini, but no luck

 

Analysis I done : In Windows 7 Operating system Outlook component installed with 32 bit , so our application was running fine but in Windows 10 Operating system , Outlook Component I checked it is 64 bit and our PB application is 32 bit, so that's why 32 component PB will not support 64 bit Outlook component.

Please provide the solution so I can fix my problem.

Thanks &Regards

Vipul Srivastava

 

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 7 January 2021 16:13 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Vipul ;

  This is a known issue with MS-Office. You have few choices with Office 365 ...

  1. Install MS-Office 32bit client to match the 32bit PB App EXE
  2. Recompile your PB App into a 64bit EXE
  3. Create a 64bit PB App that interfaces to MS-Office 64bit that is called from your current 32bit App EXE to "broker" email requests

Regards ... Chris

 

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 7 January 2021 16:48 PM UTC
Or better yet .. forget about MAPI & OLE and use SMTP instead! ;-)

FYI: http://www.topwizprogramming.com/freecode_emailsmtp.html

  1. Helpful
  1. Roland Smith
  2. Thursday, 7 January 2021 20:16 PM UTC
The security library used by that example is old so may not work for your mail server.

Instead you can use my PBNISMTP, a variation on Bruce's PBNISMTP library:

https://www.topwizprogramming.com/pbnismtp.html
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 7 January 2021 20:57 PM UTC
Note that Appeon will also be adding SMTP as a native feature to PB ...

https://www.youtube.com/watch?v=u6xFgAwptWs

See time frame 1.05.35
  1. Helpful
There are no comments made yet.
Vipul Prakash Srivastava Accepted Answer Pending Moderation
  1. Monday, 11 January 2021 14:25 PM UTC
  2. PowerBuilder
  3. # 1

Hi Chris,

Thanks for helping us.

  // declare OleObject variable and Constant Variable 
 oleobject oleOutlook 
 oleobject oleAppt 
  Constant Integer olAppointmentItem = 1 
   
 // create the Object 
  oleOutlook = create oleobject 
  
 // Connect To the Outlook Object 
 oleOutlook.ConnectToNewObject ('Outlook.Application') 
   
 // Create the Appointment Object 
  oleAppt = oleOutlook.CreateItem (olAppointmentItem) 
  
  // Set some common properties of Appointment Object 
 oleAppt.Location = "Home" 
 oleAppt.Subject = "Test Vipul" 
 oleAppt.Start = "01/12/2021 19:00" 
 oleAppt.ReminderMinutesBeforeStart = 1 // in minute 
  oleAppt.Duration = 120 // in minute 
 oleAppt.Body = "Go Corona Go !!"
 
 // Save the Appointment 
 oleAppt.Save ()

I tried this one and I can easily create the New meeting request with outlook 64 bit component with PB 32 bit .

Now I want to open the recipient list , so for this thing do you have any idea how and what function or property i can use for open the Recipient list?

 

Please help me .

Regards

Vipul

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 12 January 2021 18:00 PM UTC
  2. PowerBuilder
  3. # 2

Simplemapi to open an address book or send email on Office 64 doesn't work. It only works with Office 32 bits.

If you set simplemapi=no, then you'll run into a whole other range of things that "simply" don't work well.

You can use OLE to open an address book. The only disadvantage of doing so, is that the Outlook address book will keep flashing below in the programs toolbar and the user has to click on it to bring it to front.

 regards.

Comment
  1. Chris Pollach @Appeon
  2. Saturday, 16 January 2021 15:20 PM UTC
Hi Miguel;

What I do in this case is build a 64bit PB App that does the MAPI interaction. Then call the 64bit App from your 32bit PB App when you need Outlook interaction.

Food for thought.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Vipul Prakash Srivastava Accepted Answer Pending Moderation
  1. Saturday, 16 January 2021 12:21 PM UTC
  2. PowerBuilder
  3. # 3

Hi Miguel,

As per your suggestion , I tried Below code to create the calendar Invite and it is working fine from my side.

// declare OleObject variable and Constant Variable 
 oleobject oleOutlook 
 oleobject oleAppt 
  Constant Integer olAppointmentItem = 1 
 // create the Object 
  oleOutlook = create oleobject 
  
 // Connect To the Outlook Object 
 oleOutlook.ConnectToNewObject ('Outlook.Application') 
   
 // Create the Appointment Object 
  oleAppt = oleOutlook.CreateItem (olAppointmentItem) 
  
  // Set some common properties of Appointment Object 
 oleAppt.Location = "Home" 
 oleAppt.Subject = "Test Vipul" 
 oleAppt.Start = "01/12/2021 19:00" 
 oleAppt.ReminderMinutesBeforeStart = 1 // in minute 
  oleAppt.Duration = 120 // in minute 
 oleAppt.Body = "Go Corona Go !!"
 
 // Save the Appointment 
 oleAppt.Save ()

 

I want one more thing , I need to open the Recipient Address Book from Outlook for this I don't have idea like above code, what function and what class I need to use for populating the Recipient Global Address book.

 

Could you please help me on this part.

Regards

Vipul srivastava

 

Comment
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.