Use EWS API with C#Reflection

Asked

Viewed 43 times

1

I am trying to use the EWS API in SSIS Script Task, but the server does not have the corresponding dll: Microsoft.Exchange.WebServices.dll

So using Reflection is the only solution I found, the dll file is on the server available for use.

I need to instantiate a subclass of an abstract class, but the compiler of this error message: Not found the constructor of Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo

That’s my code, I tried the following solutions to catch the guy SearchFilter.IsEqualTo but without success:

Type typeSearchFilter = DLL2.GetType("Microsoft.Exchange.WebServices.Data.SearchFilter");

var typeSearchFilterIsEqualTo = typeSearchFilter.GetNestedType("IsEqualTo");

Type typeSearchFilterIsEqualTo0 = DLL2.GetType("Microsoft.Exchange.WebServices.Data.SearchFilter+IsEqualTo");

Type typeSearchFilterIsEqualTo1 = DLL2.GetType("Microsoft.Exchange.WebServices.Data.SearchFilter.IsEqualTo");

dynamic searcherFilter = Activator.CreateInstance(typeSearchFilterIsEqualTo, new object[] { folderSchemaDisplayName, folder});
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.