We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set Importance to MapiCalendar Object using Aspose.Email for java API

I have to create calendar from MapiCalendar Object. So i have to set Importance to MapiCalendar Object. Please provide me some sample code.


Please give a try to following sample code and share the feedback.

public static final byte[] intToByteArray(int value) {
return new byte[] {
(byte)(value >>> 24),
(byte)(value >>> 16),
(byte)(value >>> 8),
private static void testEmail4()
byte[] importance = intToByteArray(MapiImportance.Normal);
MapiCalendar cal = new MapiCalendar();
MapiProperty property = new MapiProperty(MapiPropertyTag.PR_IMPORTANCE, importance);


Hi @kharade.a,

I used your code above to try to set Importance to MapiTasks but it didn’t work.

byte[] b = intToByteArray(MapiImportance.High);
MapiProperty mpImportance = new MapiProperty(MapiPropertyTag.PR_IMPORTANCE, b);

When I use OutlookSpy to see the MapiProperties, it shows this:

PR_IMPORTANCE (0x00170003)
33554432 (<— I think this value should be 2)

Can you tell me what’s wrong?



I think you have already opened up a ticket with us in following thread. Is this the same issue or different.

Hi @mudassir.fayyaz,

This is a different problem.
The other thread is about creating a whole MapiTask using MimeContent returned from EWS.
This is about only setting the Importance property of a MapiCalendar object.



In that case, please provide the working sample code and source file reproducing the issue so that we may log that in our issue tracking system for investigation.


MapiTask task = new MapiTask();
byte[] bImportance = intToByteArray(MapiImportance.High);
MapiProperty mpImportance = new MapiProperty(MapiPropertyTag.PR_IMPORTANCE, bImportance);


After testing same code using Aspose.Email for .NET 20.9.1 on my end, I can see the value 2 in array as expected.

image.png (31.4 KB)


I’m afraid this is not the platform we are talking about.
I’m using Aspose Email for Java 20.9 (as mentioned ealier in this thread).


Using Aspose.Email for Java 20.9 too I am able to get correct values. Please check the attached image.



You changed the intToByteArray() function.
Now it works, thank you very much for your help!


That’s great it helped you.