none
[E2010][EWS][JAVA][LINUX]: setExtendedProperty with MapiPropertyType.Binary RRS feed

  • Question

  • Bonjour.

    Sorry for cross-posting. I have posted this initially in the wrong forum.

    I have to enhance an existing JAVA app to store deadlines into several calendar all owned (created) by the same Shared-Mailbox.

    Synchronisation of the deadlines in the app and the outlook calendars is no problem.

    Apart from syncing the dates the JAVA app should be able to send invitations to the specific calendar. I have used the description of mikewillcode4food (sorry, not allowed to post the link - not verified account (???)). I needed to port that stuff from c# to JAVA. On sendAndSaveMessage I always receive this Exception:

    microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. An internal server error occurred. The operation failed.
    	at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74)
    	at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158)
    	at microsoft.exchange.webservices.data.core.ExchangeService.sendItem(ExchangeService.java:789)
    	at microsoft.exchange.webservices.data.core.service.item.EmailMessage.internalSend(EmailMessage.java:156)
    	at microsoft.exchange.webservices.data.core.service.item.EmailMessage.sendAndSaveCopy(EmailMessage.java:300)

    Using the debugger I found out, that all Extended Properties of MapiPropertyType.Binare have a null value. That's eg.

    byte[] binInitiatorEntryId = hexStringToByteArray(initiatorEntryID);
    
    ExtendedPropertyDefinition pidLidSharingInitiatorEntryId = 
          new ExtendedPropertyDefinition(propertySetSharing, 0x8A09, MapiPropertyType.Binary);           
    invitationRequest.setExtendedProperty(pidLidSharingInitiatorEntryId, binInitiatorEntryId);

    So in the debugger the extended property exists, but the value is "null".

    All other fields that are noted in the example look ok in the debugger. It's just that the binaries are all "null". I also compared the sharing_metadata.xml attachment with one created by Outlook and they are identical. Ok, there are a few fields I got to play with (let's say: do I have to use a "special folder" for pidLidSharingFlavor because I didn't find any explanations in the specs on what is a special folder). But since it is obvious that a "null" value for MapiPropertyType.Binary is not correct it does not make any sense to check other possibilities.

    So mainly there are two questions regarding this issue which I hope someone with a bit more experience could explain:

    Question 1: Is there any special way in JAVA to store Extended Properties of MapiPropertyType.Binary?

    Question 2: Is there any way to get more information on the "internal server error occured" from EWS? Even enhancing the trace does not give any more information beside the XML representation of the message.

    Thanks in advance.

    ChriS


    Friday, May 3, 2019 7:43 AM

All replies

  • Hey Chris,

    I'm encountering the same issue when trying to set Reply Recipient Entries (0x004F), which requires Binary type as well for input. 

    So far I haven't found any fixes, but I found more about the cause:
     - I believe the property is set to null due to the value class not equating to the required value class specified in MapiTypeConverterMap. We are sending it byte[], while MapiPropertyType.Binary requires Byte[]. Due to this inconsistency, a method that assigns the value returns null: https://github.com/OfficeDev/ews-java-api/blob/master/src/main/java/microsoft/exchange/webservices/data/misc/MapiTypeConverterMapEntry.java#L158

    - If we set our value to Byte[], the assignment works, but it triggers a bug in ExtendedProperty when attempting to log the change. Specifically, the equals() function attempts to convert Byte[] into byte[], which is not allowed: https://github.com/OfficeDev/ews-java-api/blob/master/src/main/java/microsoft/exchange/webservices/data/property/complex/ExtendedProperty.java#L185

    I'm totally stumped. I assume this is the case for all Binary type assignments. Have you found a fix yet?


    • Edited by timmcan Friday, October 4, 2019 3:10 AM grammar and formatting
    Friday, October 4, 2019 3:10 AM