'How to list emails id of group or organization in exchange mail server using ews-java-api jar?
our company has exchange server and there are few users.So i want to list all users in our company and read emails of all users email one by one.How can i do that?
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1); // your server version
ExchangeCredentials credentials = new WebCredentials("[email protected]", "password!"); // change them to your email username, password, email domain
service.setCredentials(credentials);
service.setUrl(new URI("domain/EWS/Exchange.asmx"));
final int pageSize = 50;
ItemView view = new ItemView(pageSize);
FindItemsResults<Item> findResults;
do {
findResults = service.findItems(WellKnownFolderName.Inbox, view);
for (Item item : findResults.getItems()) {
// reading emails
}
view.setOffset(view.getOffset() + pageSize);
} while (findResults.isMoreAvailable());
With the above code i am able to get retrieve email of that particular account whose credentials i have provided in above code.But how can i list users emails id of company and retrieve emails of each user.Please help me with this. Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
