Highlighted
Absent Member.
Absent Member.
606 views

[archive] outlook CreateObject - Problem

[Migrated content. Thread originally posted on 17 August 2005]

greetings,

i wrote a program to add contacts to outlook.
I works fine on nearly all installations.
But if a ExcangeServer is involved, i get an automatation error.
I figured out the problem with a VB program.

I only needed to change this line:
Set AppOutlook = CreateObject "Outlook.Application")

to this one:

Set AppOutlook = CreateObject "Outlook.Application", "Localhost")

The only change is the "Localhost" and works fine.


And now the problem:
I use this line to start outlook in Acu:

create application of Outlook handle in outlook-handle

How to add the "localhost"?

The outlook.def look like this:
* Application
CLASS @Application
CLSID, 0006F03A-0000-0000-C000-000000000046
NAME, "Application"
DEFAULT-INTERFACE, "_Application"
DEFAULT-SOURCE, "ApplicationEvents"
* Application
PROPERTY-GET, 61440, @Application
RETURNING "_Application*", TYPE 9

Not really much "Servername" options/parameters.
Has anyone an idea how to start an activeX-outlook with "Servername" = "Localhost"?
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] outlook CreateObject - Problem

I can understand you are confused. But in this case, the definition file cannot help you. CreateObject has two parameters, the first, which is the object to create is familiar enough. The second one is more rare to use, and that is if you want to create the COM object as DCOM, e.g. Distributed COM (executing on another machine).

This would be accomplished with ACUCOBOL-GT by:


CREATE Application OF Outlook SERVER-NAME "Localhost" GIVING myapphandle.


However, as long as this both for ACUCOBOL-GT and vb is an optional parameter, it means you do not have to specify it. When you also know that Localhost is the machine you execute on, and that is the machine being used when you do not specify the host, you don't have to state it. With other words, this is doing the same as the one above:


CREATE Application OF Outlook GIVING myapphandle.


Hope this helps.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] outlook CreateObject - Problem

Gisle,

Could I apply to same DCOM logic to other applications or do that applications have to have code to support it? For example, could I do this for Word or Excel?

CREATE Application OF Word SERVER-NAME "servername" GIVING myapphandle.

Rob
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] outlook CreateObject - Problem

You can do this for all COM objects.
The catch you have to look out for is that A) the COM object has been installed on the remote machine, B) the COM proxy is installed on your local machine (normally always on newer Windows), C) that the COM object is sharing on the server and finally D) that the remote user (you on your client machine) has the sufficient privileges to execute on the server which the object actually is executing on.

I demonstrated this once using ACUCOBOL-GT Automation server, I then had a Delphi application on machine A, which executed an ACUCOBOL-GT application on machine B using DCOM.

Worked like a champ. (of course 🙂 )
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] outlook CreateObject - Problem

Thanks for the input, Gisle. That will be very valuable for me in the near future.

Rob
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] outlook CreateObject - Problem

@Gisle

i just tried it on the customer server ..

But with no effect.

by the way: His installation uses a domain-server with server based profiles. Small business server.

The "Server-Name" seems to be ignored. There is no change in the effect.

I'm wondering, why the change has an effect on the VB-Program, but not on the AcuCorp Program.

Is there another way to create the outlook instance?
Or can it be a bug and should be reported to the support?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] outlook CreateObject - Problem

This is odd. I figure we will need an example. Have you checked the software event log to see if Outlook reports anything?
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.