?
Solved

Creating a MS Outlook 2010 mail message from Powerbuilder only works when Outlook is closed

Posted on 2013-01-16
5
Medium Priority
?
1,715 Views
Last Modified: 2016-10-26
Hi
I am using Powerbuilder 11.5 and have updated the code to handle MS Outlook 2010.

The code used to work fine with earlier versions of Outlook and allowed the user to send emails from Powerbuilder with either Outlook running or not running, but does not work now since the Outlook version change when Outlook is running.  The code works fine when Outlook is not running.

updated version not working when Outlook open
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\14.0\Outlook\InstallRoot

previous working version of Outlook
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\10.0\Outlook\InstallRoot


The code is as follows;

//Declaration
OLEObject myoleobject, db, doc, rt_item, loo_ol_msg_cast

myoleobject = CREATE OLEObject
//  loop for two minutes, or until notes is started successfully
t_StartTime=Now() //wait 2 min for Notes to load ...
Do
	Yield()	//yeld control occasionally
	SetPointer(hourglass!)
	iResult = myoleobject.ConnectToNewObject("outlook.application")	
	If iResult = 0 Then Exit	//OK, Outlook is active
	Yield()
Loop Until SecondsAfter(t_Starttime, now()) > 120	//try again in #sec

if iResult <> 0 then
	f_user_error("Could not open Microsoft Outlook")
	return FALSE
end if

loo_ol_msg_cast = myoleobject.CreateItem(0)

Open in new window


The code fails on the above line (CreateItem) when MSOutlook is running
This works fine when MSOutlook is closed - the mail is generated and sent

I cannot find what is needed to allow a new mail to be generated when MS Outlook is open - I would be really grateful for any assistance - thanks Wingmanshaks
0
Comment
Question by:wingmanshaks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
virtuadept earned 2000 total points
ID: 38794034
Hm. That looks like correct syntax for OLE integration. I tried an example that was very similar and it worked, PB 11.5 and Outlook 2010.  Maybe it is something messed up in the registry?

What error is it giving back?


http://downloads.sybase.com/codexchange/powerbuilder/404/PowerBuilder_-_Controlling_the_Outlook_session_using_OLE.htm
0
 
LVL 8

Expert Comment

by:virtuadept
ID: 38864030
Just checking if that previous answer was helpful or not?
0
 

Expert Comment

by:Carson LuzHoxsie
ID: 41860508
Use the following if Outlook is not running.
myoleobject.ConnectToNewObject("outlook.application")

If Outlook is already running, use
myoleobject.ConnectToObject("outlook.application")

Normally, check if Outlook is running first using ConnectToObject("outlook.application"), if not, use ConnectToNewObject("outlook.application") to start it.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question