Accessing COM libraries from an OutSystems Extension

Accessing COM libraries from an OutSystems Extension

Hello all,

I need to create an OutSystems extension to use COM libraries.

First I added the references to the COM libraries in the "Edit Source Code"!Then I created the code to call the method in the COM librarie.

But, I need all the functions from the COM Libraries...

I tried to create a .Net Library and ADD References from he COM library but in the OutSystems Add .net Assembly I doesn't can access the COM functions

Anybody as an ideia how to do this...

Hi Nuno,

You have to create a .Net wrapper for the COM. That wrapper must have methods that call the COM methods, not only the reference to it.
Integration Studio can then introspect the .Net code and will import those methods.

If it is a common COM object perhaps you'll find already a .Net wrapper for it on the internet.

Hope this helps you.



Let me see an example... I have 10 COM Libraries to reference, in which Library i will need 10 I need to have 100 methods that call COM methods...

That's it?

Hi Nuno,

Haven't fully tried it but I think this might help you. When you reference the COM in Visual Studio it will create a wrapper to it for you. This will be something like Interop.<Library>.dll. You can then import the actions of this .net assembly in Integration Studio.
I tried it with the Windows Script Host Object Model COM and could create the Extension (attached), didn't use it though...

Give it a go and see if that does the job.


Many thanks André but this don't work...

When I "Add Reference to my COM libraries the wrapper doesn't as created...

So, start from the beginnig...

1 - In VS Create a new Class Library

2 - Add References's

3 - The wrapper will create automatically and then I can Import the .NET Library to the Extension Action Area, ok?


Your steps are correct so far, so....

 3a - Visual Studio will create a Interop.<Library>.dll file in <Solution Directory>\obj\Debug
 4 - Open Integration Studio and create a new Extension
 5 - Import actions from .NET Assembly, browse for the Interop...dll file

You'll get the same output as I posted earlier.


My task is not so easy...

The COM assemblies uses references from another COM assemblies!

On Integration Studio, when I imported the first Interop COM assembly is everything ok, but then when i tried added more .NET assemblies I get an error...
"Missing Assembly Reference".

Any idea?

Has you tried to Publish your Extension???


Attached you'll find a working example. I have tested it as you can below.

You were right, my first extension didn't compile, solved it by removing the unnecessary methods. 

Now, I'd say that if you have references in your COM's when you import the dll in Visual Studio it'll create more dll's than just the Interop one. You'll need to add them to the extension also. Open the extension's source in Visual Studio and add those references to it. See if it compiles in Visual Studio. Then you should be good to go.

Hint: When you add actions from a dll you don't need to add them all like I did, but be aware that you must have a constructor if the methods are not static.


Thank you for this example André.

But two things...or two problems...

When I create one Class Library with COM reference and "Build", everithing ok.
Next I add the Action(.NET assembly) to my extension
But when I tried to publish i've got .NET errors...I don't understand...
Then I open VS I tried to correct the errors but I can't comment the methods...(because I don't now what I  need). This COM Assemlies are the "Motor Integração- ERP PRIMAVERA", and I don't know what I I wan't create a full "Motor".

By other side...

When I tried to Import the other COM References in the Integration Studio i've got an error:


I removed the CreateObjRef, InitializeLifetimeInstance and GetLifetimeInstance methods. These were the one's giving trouble.

As for the dll references you'll need to meet those requirements.

A part from all this I think you should explore a different type of integration with the Primavera ERP. Don't you have other options like webservices?

I haven't another option...I need to use the "Motor Integração Primavera", because is a Project Requirement...

I have tried a lot of different things and nothing works good...


mscorlib is part of the .NET framework. Could it be that you're using .NET assemblies built against different framework versions? You may try specifying the "mscorlib.dll" file that you can find in
C:\Windows\Microsoft.NET\Framework64\v2.0.50727 (in 64bit systems) or C:\Windows\Microsoft.NET\Framework\v2.0.50727 and see if works.