where's the API?

S

Stephan Steiner

Hi

As the title says, I'm looking for an API documentation for the
Microsoft.Office.Interop.Outlook PIA. I searched the MSN library but without
sucess. I'm trying to catch Inspector closing events but that's quite
difficult without having a clue what objects and methods are available (let
alone any samples on how to use them). I've managed to get somet things
going by trying to "translate" existing VB code to C#, but more and more I'm
just running into brick walls so I really need some useful documentation.

Any help would be appreciated

Stephan
 
S

Stephan Steiner

Sue
The only documentation is the Outlook object model; there's nothing
separate

Hmm... but that model does not necessarily seem to hold. For instance, let's
take a ContactItem. VS.NET 2k3 won't even show me the ContactItem.Close
event, and sure enough, if I try to attach an event listener to it

myContactItem.Close += new
Outlook.ItemEvents_CloseEventHandler(Contact_Close);

(something work works just fine for myContactItem.Close), I get the
following error when I try to compile:

'Microsoft.Office.Interop.Outlook._ContactItem.Close(Microsoft.Office.Intero
p.Outlook.OlInspectorClose)' denotes a 'method' which is not valid in the
given context

So, since the object seems not to exhibit the close event, VS seems to think
I'm trying to add an eventlistener to the regular ContactItem.Close method,
which obviously won't work.

The same applies to many other items in the object hierarchy.

Do you know a way to still get access to those events? And I don't suppose
there's a structured hierarchical document like the .NET API for the Outlook
Object model, is there? The MicroEye graphic is certainly useful as a
general overview, but when you want to go into details, more info wouldn't
hurt.

Regards
Stephan
 
L

Lars-Erik Aabech

Not sure if I understand what documentation you're looking for, but the last
top-node of the help file in Outlook contains full documentation of the
object model. Look for "Microsoft Outlook Visual Basic Reference" in the
help ;)
It should be the same as the components you get through
Microsoft.Office.Interop.Outlook

HTH,
L-E
 
S

Sue Mosher [MVP-Outlook]

No, as I said earlier, there is no additional documentation for .NET for
Outlook (or the other Office programs, AFAIK).

In the Outlook object model, there is both a Close method and a Close event.
I think you need to be looking at ItemEvents.Close (the event) not
ContactItem.Close (the method). But don't hold me to it. <g> I'm just
getting my feet wet and am nowhere near fluent on .Net issues.

FYI, the "interop" title of this group refers to application
interoperability not to COM interop. Outlook programming questions, even for
..NET, wind up in microsoft.public.outlook.program_addins or program_vba

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Stephan Steiner

Sue
In the Outlook object model, there is both a Close method and a Close event.
I think you need to be looking at ItemEvents.Close (the event) not
ContactItem.Close (the method). But don't hold me to it. <g> I'm just
getting my feet wet and am nowhere near fluent on .Net issues.

Well.. I don't know where the Itemevents are exposed, but certainly not on
any Item - and neither on the Inspector. Therein lies my problem.. the VBA
Outlook Object documentation is fine, but if things work differently in
..NET - especially in non VB languages, I'd expect this to be written down
somewhere.
FYI, the "interop" title of this group refers to application
interoperability not to COM interop. Outlook programming questions, even for
.NET, wind up in microsoft.public.outlook.program_addins or program_vba

OK, noted ;)

Stephan
 
L

Lars-Erik Aabech

Well.. I don't know where the Itemevents are exposed, but certainly not on
any Item - and neither on the Inspector. Therein lies my problem.. the VBA
Outlook Object documentation is fine, but if things work differently in
.NET - especially in non VB languages, I'd expect this to be written down
somewhere.

I think "interop" vs. Outlook in .NET is an automated process of creating
..NET wrappers around the same components you'd use in VBA / VB6 etc. Hence
you'll have to find out how .NET treats old components and how to handle old
events. This IS documented, but I'm not sure where.. ;) (Try looking for
general COM interop information in the .NET documentation)

GL!

Lars-Erik
 
S

Sue Mosher [MVP-Outlook]

I wonder if the different classes derived from COM objects are inheriting
from a base ItemEvents class. In any case, I had no problem getting Close to
work in VB.Net code. Sorry I don't speak C# if that was what you were
looking for, but I'll be happy to post the VB.Net version if you need it.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Stephan Steiner

Sue
I wonder if the different classes derived from COM objects are inheriting
from a base ItemEvents class. In any case, I had no problem getting Close to
work in VB.Net code. Sorry I don't speak C# if that was what you were
looking for, but I'll be happy to post the VB.Net version if you need it.

Thanks for the offer. I already found an example on MSDN, unfortunately it
doesn't help. In VB.NET, as in VB, you can just get all events when
declaring the object with WithEvents, something which won't fly on C# (and
C++ for the matter).

As an example, here's how an Item.Open is handled in VB.NET:

Private Sub m_olContactItem_Open(ByRef Cancel As Boolean) Handles
m_olContactItem.Open

Translated to C# this gives

myContactItem.Open +=new
Outlook.ItemEvents_10_OpenEventHandler(myContactItem_Open);

So, you have to explicitly register for each event. And while the closing
event works just the same in VB.NET, there's no myContactItem.Close event
for which an eventhandler can be registered. This is kind of weird since in
..NET all languages are supposed to have the exact same object model.

I really hope somebody will be able to shed some light on this eventually as
it's a major roadblock for me at the moment (for certain user actions it
seems to be a must to catch the close event)

Stephan
 

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