How to get credentials from windows logged user?
Hi ! I need some help .. I'm writing a service that is intended to get the number of unread messages from the logged user (the one who make the request) inbox folder. The problem i'm having is that i don't have the user exchange password. I've tried to do the following, but with no success. Is there a way to achieve that? The user is already logged in Active Directory
service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.setUrl(new URI("https://myexchange/ews/Exchange.asmx"));
service.setUseDefaultCredentials(true);
service.setTraceEnabled(true);
Thanks!
p.s: sorry about my english !
maybe see this post for help.
Hello,
I have same issue, Did you find solution for this?
@hshoushari Do you use on-premises Exchange server? Are you executing your code from computer that is in the same Active Directory structure like your Exchange server?
@pkropachev Hello, Thanks for reply,
yes, my computer and application are using same Active Directory like Exchange server? and its in the same company and same network.
At the first glance this feature doesn't work in library from out of box. I'm afraid the library should be modified. I'll check it more carefully.
thank you very much,
to provide more details:
when i add credentials in my code its working fine:
public MailService() {
final ExchangeCredentials credentials = new WebCredentials("cms1", "#######", "fanr");
service.setCredentials(credentials);
}
but i need to fetch emails depend on the loged in user credentials without passing static username and password.
in the project environment:
we are using spring mvc and weblogic server, we authenticate the users using active directory
and now i want to fetch user emails from msexchange server, wich is also using same active directory.
thank you in advance.