COM Add-in by Using Visual C# .NET

P

Peter

Hello,

Thanks for reviewing my question. In reference to
knowledge base article: 302901 - HOW TO: Build an Office
COM Add-in by Using Visual C# .NET.

I followed the article and got everything work correctly
but of course I want to do more. If Outlook is loaded, I
assume the object applicationObject must be Outlook's
Application Object - Is this correct? Can I just cast it
to Outlook._Application object? I want to be able to be
able to create new contacts for instance.

Since this project started from a Shared Add-in, by
default VS.NET includes the Office.dll reference. When I
reference other Office 2003 programs like Access, Excel
and Outlook, doing so includes another reference
Microsoft.Office.Core. If I compile my program now, I
get multiple warnings:

'Microsoft.Office.Core.CommandBar' is defined in multiple
places; using definition
from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
\office.dll'

What's wrong? I reference Access, Excel and Outlook in
order to gain access to their Application object.

Many Thanks to the Experts.
Peter
 
P

Peter

Siew,

Glancing at the article, I noticed the following code
segment:
applicationObject = (Outlook.Application)application;

What actually am I assigning - a pointer, a reference?

I ask this because if I ever need to pass this
applicationobject to a function, I want to know if I
should being passing it as a reference or by value.

Thanks
Peter
 
S

Siew Moi Khor [MS]

Hi Peter,
You are casting a value object passed to the .NET class via COM Interop.
Passing it either by ref or by val to other functions in the application is
a matter of choice.

Siew Moi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top