How can I create a PT_SYSTIME byte array from a java Date object so that I can build a MapiProperty.
Basically I need to do this:
Date date = new Date();
byte[] dateArray = new byte[8];
…somehow convert date --> dateArray…
MapiProperty prop = new MapiProperty(MapiProperty.PR_DELIVER_TIME, dateArray);
I am stuck using an older version of your API so I don’t have the ability to call “createMapiPropertyFromDateTime(long tag, Date data)”. So I have to use instead the older MapiProperty constructor with the byte array.
Thanks, I tried that but the resulting data did not seem to set the appropriate date correctly.
I tried this and it seems to work, but it’s a huge workaround and gives different result than what your code does. I would assume it should do the same thing?
Date date2set = new Date(timestamp);
//Create an empty mapi message and set the client submit date
MapiMessage msg = new MapiMessage();
msg.setClientSubmitTime(date2set);
//After setting the mapi-property, retrieve the raw data
byte[] data = msg.getPropertyBytes(MapiPropertyTag.PR_CLIENT_SUBMIT_TIME);
//Now return the data
return data;