GraphApi listMessages getItemId() not unique

Hi,

We use the GraphAPI java 22.9 version and have been successfully reading emails from an MS mailbox using listMessages() and fetchMessage(msg.getItemId()) and then delete(msg.getItemId()) for some time now. As of recently we are seeing the below situation.

1 item ID MzoxNTI6NDI6MjY6MDowOkFBTWtBRGcwTlRsaU16RTFMVFl3T1RRdE5HWm1OUzFpTldZMExUTXpOVFF3WW1NMk9UVTVOQUJHQUFBQUFBRHg1TzB2cklZVFJMcklubkRzcTJKckJ3Q3k5d0hLV1Q2RVNyZHJvYzVnOVIwYUFBQUFBQUVNQUFDeTl3SEtXVDZFU3Jkcm9jNWc5UjBhQUFIYlZ4dWhBQUE9Vy8iUUFBQUJZQUFBQ3k5d0hLV1Q2RVNyZHJvYzVnOVIwYUFBSGJWOC8ibWFpbEZvbGRlcnMvaW5ib3gvbWVzc2FnZXM=
message ID <DS7PR11MB59678148CB301C46EFC3C110E5879@DS7PR11MB5967.namprd11.prod.outlook.com>
subject Re: Testing
date Thu Mar 23 13:07:41 MDT 2023
2 item ID MzoxNTI6NDI6MjY6MDowOkFBTWtBRGcwTlRsaU16RTFMVFl3T1RRdE5HWm1OUzFpTldZMExUTXpOVFF3WW1NMk9UVTVOQUJHQUFBQUFBRHg1TzB2cklZVFJMcklubkRzcTJKckJ3Q3k5d0hLV1Q2RVNyZHJvYzVnOVIwYUFBQUFBQUVNQUFDeTl3SEtXVDZFU3Jkcm9jNWc5UjBhQUFIYlZ4dWdBQUE9Vy8iUUFBQUJZQUFBQ3k5d0hLV1Q2RVNyZHJvYzVnOVIwYUFBSGJWOC8ibWFpbEZvbGRlcnMvaW5ib3gvbWVzc2FnZXM=
message ID <DS7PR11MB5967BFFA93F31A4A3FE0BF1AE5879@DS7PR11MB5967.namprd11.prod.outlook.com>
subject Re: Testing
date Thu Mar 23 13:07:37 MDT 2023

We call fetchMessage with the item id successfully. We process the email and then call delete for the item id successfully. We then try to read and delete the second message returned by listMessages but since we deleted it already we get failures because the itemId is not unique.

I tried using getMessageId() as I know it is unique but fetchMessage threw an exception when I pass the message Id as the parameter.

com.aspose.email.system.exceptions.FormatException: The string contains invalid characters
at com.aspose.email.internal.b.zh.j(Unknown Source)
at com.aspose.email.zzi.b(SourceFile:249)
at com.aspose.email.zzi.c(SourceFile:283)
at com.aspose.email.zyw.(SourceFile:62)
at com.aspose.email.zyi.fetchMessage(SourceFile:250)

I see in 22.7 release notes some discussion of what seems similar and possibly addressed by obtaining a UID or sequence number, but I don’t see that available in the 22.9 java graph api.

Example of our code, simplified:

GraphMessageInfoCollection messages = eslGraphClient.listMessages();
for (GraphMessageInfo messageInfo : messages) {
MapiMessage message = eslGraphClient.fetchMessage(messageInfo.getItemId());
eslGraphClient.delete(messageInfo.getItemId());

Please advise on how we could approach this differently or fix it.

thanks,
Mike Little

@mlittle4444
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): EMAILJAVA-35156

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you for the quick reply and putting this on your schedule. Will this require a license renewal for 2023, any idea on typical turnaround for something like this?

Hello @mlittle4444,

We need to investigate the problem, and then we can give some explanations.
Thank you.

@mlittle4444,

You cannot use MessageId on the fetchMessage method. Only the ItemID can be used to fetch a message.
The ItemID is unique for both messages(1,2):

..>h<BQUE9Vy8iU..
..>d<BQUE9Vy8iU..

Could you give us more details about the delete error:

We then try to read and delete the second message returned by listMessages but since we deleted it already we get failures because the itemId is not unique.

Sorry, my bad didn’t notice the 1 char diff. I attached 2 log files. The results I am getting today are different, one is with delete on the 1st message, the other failure to fetch the second message. Also, it seems this started happening a couple months ago if that is helpful, maybe there was an IT change in Comcast’s email system, not sure, but we didn’t change code(your library or the way we are using your library). One of the problems I recreated today was when the originators were different. I don’t think I have seen this occur when we only process 1 message. Let me know if there is anything else I can collect for you. thank you!

deleteMessageFailure.docx (17.6 KB)
fetchMessage2ndInvalidHttpResponse.docx (18.3 KB)

@mlittle4444,

Could you collect logs with an additional option?

-Djava.util.logging.config.file=/full/path/to/logging.properties
// or
System.setProperty("java.util.logging.config.file", "/full/path/to/logging.properties");

logging.properties:

handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = FINEST
sun.net.www.protocol.http.HttpURLConnection.level = ALL

output:

Mar 26, 2023 10:09:09 PM sun.net.www.protocol.http.HttpURLConnection writeRequests
FINE: sun.net.www.MessageHeader@28975c289 pairs: {POST /b960365f-f7e3-4bc3-841f-13b298a34..
Mar 26, 2023 10:09:10 PM sun.net.www.http.HttpClient logFinest
FINEST: KeepAlive stream used: https://login.microsoftonline.com/b960365f-f7e3-4bc3-841f-..
Mar 26, 2023 10:09:10 PM sun.net.www.protocol.http.HttpURLConnection getInputStream0
FINE: sun.net.www.MessageHeader@3943a2be16 pairs: {null: HTTP/1.1 200 OK}{Cache-Control: no..

Couldn’t manage to get that logging working that way, tried for some time and got pulled away. I was able to get some networking details via System.setProperty(“javax.net.debug”, “all”). Attaching log for scenario where 1st message read successfully and deleted successfully, but 2nd message creates an exception even though http response for the fetchMessage appears to be 200 OK. msg1good_msg2readexception.pdf (826.5 KB)

@mlittle4444,

Ok, thanks for the info.

@mlittle4444,

Could you check the issue with TLSv1.2 option:

System.setProperty("jdk.tls.client.protocols","TLSv1.2");

Here are those results with scenario of Message 1 success on read and delete, Message 2 failure on read. thankstls12_msg1good_msg2readfail.docx (299.3 KB)

Hello @mlittle4444,

Thanks for the information provided on the problem.

@mlittle4444,

We have reproduced the issue and are working on a fix.

1 Like

Hi, Any update on release date of the fix?

thank you,
Mike

@mlittle4444,

We have fixed the issue with release 23.3

1 Like