11/28/2024 9:27:27 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss SalesLogix legacy development including views, scripts, etc.. View the code of conduct for posting guidelines.
|
|
|
|
Displaying an Email Window
Posted: 26 Feb 09 6:13 PM
|
I am working on upgrading a 6.2 LAN system to 7.2.
I have a customized version 7 Opportunity Detail that calls a legacy script which creates an Outlook 2007 message (that's quite a mix, huh?). The code is:
' Create Outlook mailitem. Set objOutlook = CreateObject("Outlook.Application") Set objMailItem = objOutlook.CreateItem(olMailItem) ' Display Blank Mail Item so we can get Signature
objMailItem.Display
The result is that the Outlook message window opens, but I get a General Error on the line immediately after the line with the .Display method, and the script stops executing at that point.
What might be going on here?
|
|
|
|
Re: Displaying an Email Window
Posted: 05 Mar 09 1:23 PM
|
I have found a message online that I believe may explain what I described above. Unfortunately, the suggested solution is a bit above my development skills. Any suggestions from the dev gurus here?
Re: Incorrect Function - MSOutlook 2003 Dmitry Streblechenko [Jul 8 2006, 19:18] Yes, a try...except block would do. All COM automation methods return an integer result code (HRESULT), it is just Delphi (and VB) hides that by making what is known in Delphi as safecall calling convention: on the low level, a function is called, the last [out] parameter is treated as the function result, and the compiler checks the real function return result. Delphi raises an error it is anything but S_OK (0), but VB checks if it is > 0 (that's what SUCCEEDED macro/function does). You can turn off safecall mapping before importing a type library ("Tool | Environment Optiond | Typer Library | SafeCall Funcction Mapping"), then import the Outlook type library - all method will return HResult with an extra [out] parameter.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"Peter Batten" wrote in message news:44aeeed6@newsgroups.borland.com > So Dmitry, > > Are you suggesting that placing an error handler around the display method > should resolve this? > > I am not quite sure I understand the difference between S_OK and SUCCEEDED > as I don't see a return value for Display > > "Dmitry Streblechenko" wrote in message > news:44ad4298$1@newsgroups.borland.com >> Which lines of code exactly cause those errors? >> The latest SPs of Outlook tend to return non-critical (>0) errors from >> several methods (most notably MailItem.Display). Such errors can be >> safely >> ignored, but Delphi gets all freaked out because it only tests for S_OK > (=0) >> instead of SUCCEEDED (>0). >> >> Dmitry Streblechenko (MVP) >> http://www.dimastr.com/ >> OutlookSpy - Outlook, CDO >> and MAPI Developer Tool >> >> "Peter Batten" wrote in message >> news:44ac4063$1@newsgroups.borland.com >> >I have a number of MSOutlook functions working perfectly on most >> >systems. >> > >> > I now have 2 user reports of an "Incorrect Function" error when > connecting >> > to Outlook using operating system WinXP and Outlook 2003. I am >> > guessing >> > that this is a subtle syntax error in the different versions. I am > unable >> > to >> > duplicate the error and not all machines with the same configuration >> > report >> > the same error. >> > >> > Any clues appreciated >> > >> > TIA >> > >> > Peter
|
|
|
|
Re: Displaying an Email Window
Posted: 05 Mar 09 4:16 PM
|
I figured out how to do the error handling here.
Apperently recent editions of Outlook (more recent that since the legacy plugin I'm working on was originally written) return a value on MailItem.Display that Delphi interprets as a critical error, although it is not. A simple "On Error Resume Next" didn't work, but I was able to goto a function that ran a "resume next" and move past the runtime false alarm. |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|