ews-java-api
ews-java-api copied to clipboard
Potential Class Type Incorrectly Set to Byte[] instead of byte[] in MapiTypeConverter.java
Hi,
I'm currently attempting to send an Message with ExtendedPropertyDefintions. In the case where the MapiPropertyType is Binary, the value never gets assigned due to the code below:
https://github.com/OfficeDev/ews-java-api/blob/33235f37d97871f17c496526aad0b8c458f904c3/src/main/java/microsoft/exchange/webservices/data/misc/MapiTypeConverter.java#L79
Here's a snippet of how to reproduce it:
ExtendedPropertyDefinition replyRecipientEntries = new ExtendedPropertyDefinition(0x004F, MapiPropertyType.Binary); byte[] entriesByteArray = Hex.decodeHex("test data"); message.setExtendedProperty(replyRecipientEntries, entriesByteArray);
The result will have value set as null for this property.
If we pass in Byte[], it triggers an error here, when attempting to convert to string value. This causes a cast error from Byte[] to byte[].
Is this considered an issue? Have anyone else successfully assigned a value to an ExtendedPropertyDefinition with type MapiPropertyType.Binary?
It's a bug in the library. I made a fix here: https://github.com/FacilityNet/ews-java-api/commit/d13f40763be6667ca6e84183b79769710083707f