Search code examples
c#comoffice-interop

implemented PIA interface has a callback, and no definition can be found


I am implementing the UCCollaborationLib.IContactManager interface, as explained in Integrating IM applications with Office.

I am doing it in C# as a COM+ object.

I am now at the point where Office is invoking the Lookup method from the IContactManager, but now I have to call the callback.

The method signature is:

[DispId(1610743810)]
AsynchronousOperation Lookup(string _lookupString, object _contactsAndGroupsCallback = null, object _state = Type.Missing);

And calling _contactsAndGroupsCallback.GetType().Name in the method returns __ComObject

What should I cast the callback to in order to be able to invoke it?


Solution

  • Turns out that the trick is in the name. I went through all members listed in the assembly, and there is one called _IContactsAndGroupsCallback

    I cast the object I got in the method call to that, and the invocation worked. Go MS documentation!