2

I'm trying to use the EWS Java library (link) with LispWorks 7.1.2 Win32's Java interface. I am somewhat familiar with basic Java concepts but have no experience with the Java language. This is the code I am trying to mimic:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);

So I figured I would create an ExchangeVersion object (which is an enum), set it to the value "Exchange2010_SP2", and pass it to another create-java-object expression for the ExchangeService object.

This was my first step:

(create-java-object "microsoft.exchange.webservices.data.core.ExchangeService"
 "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion.Exchange2010_SP2")

However, I get the following error message: constructor of microsoft/exchange/webservices/data/core/ExchangeService first arguments is wrong type, wanted microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion got "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion.Exchange2010_SP2"

OK, so then I tried this:

(create-java-object "microsoft.exchange.webservices.data.core.ExchangeService"
"microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion")

which gave me the error: constructor of microsoft/exchange/webservices/data/core/ExchangeService first arguments is wrong type, wanted microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion got "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion". Which doesn't make much sense to me. So finally I tried to create a standalone ExchangeVersion object:

(create-java-object "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion")

which led to this error message: CREATE-JAVA-OBJECT: : Failed to find constructors for class "microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion".

I wonder if anyone have suggestions on what am I doing wrong?

Many Thanks!

  • 1
    I never used Lispworks but it looks like (1) there is no constructor which accepts zero argument, (2) you are passing a string instead of a jobject as a second argument. Maybe you need to use `find-java-class` to get the Enum class, and then `read-java-field` ? – coredump Jan 21 '21 at 14:39
  • 1
    @coredump: You are right about passing strings, that was dumb of me. Regarding the last part: `find-java-class` did find the class but I still don't know how to create an instance. I tried to generate the class definitions automatically for ExchangeVersion and it didn't contain any constructors. – Denes Cselovszki Jan 21 '21 at 15:10

0 Answers0