ews-java-api icon indicating copy to clipboard operation
ews-java-api copied to clipboard

How to get credentials from windows logged user?

Open acaride opened this issue 11 years ago • 6 comments

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 !

acaride avatar Nov 11 '15 20:11 acaride

maybe see this post for help.

serious6 avatar Nov 11 '15 21:11 serious6

Hello,

I have same issue, Did you find solution for this?

ghost avatar Nov 19 '18 20:11 ghost

@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 avatar Nov 19 '18 22:11 pkropachev

@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.

ghost avatar Nov 20 '18 06:11 ghost

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.

pkropachev avatar Nov 20 '18 21:11 pkropachev

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.

ghost avatar Nov 21 '18 07:11 ghost