![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I have created Outlook add-in that implements my defined interface
IExposedClass (among other things for exposing some methods from add-in also). In external app (automating Outlook): object addInObj = isentrisAddIn.Object; MyExcelAddin1.IExposedClass addInExposedAgain = (MyExcelAddin1.IExposedClass)addInObj; object temp = addInExposedAgain.GetAppointments(); // Call a method on addin object DataTable dt = (DataTable) objectTemp; // objectTemp is _ComObject type calling some method, add-in that should return complex data type (eg.DataTable). While doing cast to DataTable getting invalid cast exception. The same result happens if I call GetAdressBookDT() method. In this case scenarion marshaling described on various articles doesn't work as it seems (maybe I didn't understand those articles or missed some important facts about it). on link http://forums.microsoft.com/MSDN/Sho...59557&SiteID=1 there is a good explanation what I'm trying to do. I thought that second approach would lead me to solution of my problem but... I defined my interface like this: public interface IExposedClass { object GetAdressBook(); DataTable GetAdressBookDT(); void RefreshAdressBook(); object GetAppointments(); string Test(); DataTable GetAppointmentsDT(); void RefreshAppointments(); System.Exception LastException {get;} bool IsInitializing {get;} bool IsInitialized {get;} string PluginVersion {get;} } For bool and string properties/methods interfacing to add-in is working fine. But for method that should return DataTable or object, calls to GetAppointmentsDT() are invoking _ComObject specified cast exception, and call to GetAppointments() method thtat is returning DataTable as object, in external app in fact is returning _ComObject type that I can't cast to DataTable due invalid cast exception. I was trying to find code that would help me resolve my problem doing marshaling but didn't find anything of that type. So my question is how can I accomplish that and do anybody have idea or code that would help me to figure that out? THX! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help - can't add "Item" (of type MailItem) using Attachments.Add() | [email protected] | Outlook and VBA | 1 | August 3rd 06 05:55 AM |
Calling all MVPs | Rob | Outlook - General Queries | 1 | July 25th 06 04:04 AM |
How to add integer type user-defined column to inbox? | Zoom | Outlook and VBA | 1 | May 28th 06 01:41 PM |
'Display Name' Property for Attachments.Add Method | Ned Moorfield | Outlook and VBA | 0 | May 18th 06 09:06 AM |
about CItems's Add method??? | StupidDog | Outlook - Using Forms | 0 | April 19th 06 11:15 AM |