microsoft.office.interop api

S

Stephan Steiner

Hi

I guess my search skills are lacking because I'm just unable to find this.
Is there an API documentation for the Office PIA, similar to the API
documentation for the .NET framework (which is great)?

Thanks in advance
Stephan
 
M

Mark Bower [MSFT]

Since this is just an interop layer into the existing COM interfaces
provided by Office you can use the API documentation that ships with Office
itself. It's not installed in a 'Typical' setup, but is configured as
install on demand. To get it to install, go into the VBA editor in your
favourite office app and click Microsoft Visual Basic Help on the Help menu.
 
S

Stephan Steiner

Mark
Since this is just an interop layer into the existing COM interfaces
provided by Office you can use the API documentation that ships with Office
itself. It's not installed in a 'Typical' setup, but is configured as
install on demand. To get it to install, go into the VBA editor in your
favourite office app and click Microsoft Visual Basic Help on the Help
menu.

Thanks. I have it installed. I also found a graphical version of all
classes, methods and properties of the Outlook Object model. However, there
seems to be certain differences when it comes to .NET. For instance, it's no
problem catching an Item.Close event in VB.NET. However, that event is never
exposed in C#. In fact, I've been unable so far to find any object that
could use an Outlook.ItemEvents_10_CloseEventHandler delegate. However, it
appears I need to catch this, as pressing the previous / next button in a
contact does not create either a new inspector, nor is a ContactItem.Open
event fired (not surprising since the ContactItem that I have in memory at
this time is replaced when pressing next/previous, and then a new one is
opened (for which I don't have a listener registered yet)) is not opened,
but closed.

Any ideas?

Regards
Stepan
 
M

Mark Bower [MSFT]

Try something like:
((Microsoft.Office.Interop.Outlook.ItemEvents_10_Event)item).Close += new
Microsoft.Office.Interop.Outlook.ItemEvents_10_CloseEventHandler(YourEventHa
ndlerHere);

I think the problem may be that ContactItem provides a method with the same
name as the Close event, which is why you don't see it in the intellisense.
I think that by casting to the ItemEvents_10_Event interface you should get
around this.

I hope that helps - Good luck!
 
S

Stephan Steiner

Hi
((Microsoft.Office.Interop.Outlook.ItemEvents_10_Event)item).Close += new
Microsoft.Office.Interop.Outlook.ItemEvents_10_CloseEventHandler(YourEventHa
ndlerHere);

I think the problem may be that ContactItem provides a method with the same
name as the Close event, which is why you don't see it in the intellisense.
I think that by casting to the ItemEvents_10_Event interface you should get
around this.

Actually, I figured out a way to do it. I used ContactItem, rather than
ContactItemClass, and the latter exposes Outlook.ItemEvents_10_Event_Close.
However, there's one thing I'm still fighting with: All my events are
properly fired when I open and close a contact. However, when I go to the
next contact, things start to go pretty much at random. If I add a delay
(MessageBox.Show telling me what just has happened), the events are fired in
the following order when I press next / previous:
1) new Inspector
2) ContactItem.Open
3) ContactItem.Close (well, actually ItemEvents_10_Event_Close)

When I try to go beyond the available items (so press next when I'm looking
at the last contact), I get a ContactItem.Close and that's it. Even though
the window is closed when I press that button, the
InspectorEvents_10_Event_Close I usually get when closing a contact, is not
fired. Only when Outlook is closed are the remaning
InspectorEvents_10_Event_Close events (belonging to the contact windows that
were closed when I tried to the contact before the first or contact beyond
the last one).
And it gets weirder. If I just add a Debug statement rather than showing a
messagebox, I no longer get the abovementioned 3 events in proper order.
Rather I get something which I can only describe as random behavior. Is
there a problem with those events or am I messing up somewhere?

Regards
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