A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Calling exposed add-in method and handeling _ComObject type?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 7th 06, 12:45 PM posted to microsoft.public.outlook.program_addins
Preky
external usenet poster
 
Posts: 1
Default Calling exposed add-in method and handeling _ComObject type?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 05:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.