I have to whitelist emails in outlook using java. Is there any option to whitelist emails Id's using java code
-
You need to be more clear about what you mean. Do you mean stand-alone Outlook or Office365? Do you mean the deprecated Outlook API? What you mean by email "id"? – Stephen C Jul 22 '21 at 10:32
-
But I suspect the answer is that it is not supported; see https://learn.microsoft.com/en-us/answers/questions/426256/outlook-api-junk-email.html – Stephen C Jul 22 '21 at 10:44
-
@StephenC I have a list of emails in the junk folder, I have to whitelist some of the senders using javax mail or outlook API. Currently, we are doing it by EWS API (java), but due to the deprecation of EWS API, I am searching for a new one. – Nambi Rajan.P Jul 22 '21 at 13:01
1 Answers
I think that the answer is that what you are doing will not be supported.
You are using the EWS API which is deprecated. According to Upcoming changes to Exchange Web Services (EWS) API for Office 365, the replacement is the Microsoft Graph API.
However it says:
"While EWS and Graph have mostly overlapping functionality, there are some differences. If you rely on an EWS API that does not have a Graph counterpart, please let us know via UserVoice of features needed for your app scenarios.".
I scanned the Graph and could find nothing that matched what I think you are doing. I also found this Microsoft Q&A:
Q: Outlook API - Junk email
Is there any way through the Outlook 365 API to see the "Blocked sender and > domains" list as it shown in the GUI settings under "Junk email"1?
A: Afaik no, not currently. You can use PowerShell though.
The reply is from a Microsoft MVP, so I would be inclined to believe what he says. (But if you don't ... feel free to read the Graph API documentation thoroughly, and come to your own conclusions.)
The fact that you are using Java is not going to change this. It is the underlying RESTful APIs that are being deprecated.
1 - This is is not exactly what you are proposing, but I would be hugely surprised if the Graph API allowed you to add or remove blocked domains but not see the current list of blocked domains.

- 698,415
- 94
- 811
- 1,216