0

I have integrated an asp.net web application with office 365 mail using o365 api client library.I have a specific requirement, suppose I have stored the o365 mail id of other users in my database.The o365 mail username/ password also stored in my local database. Is there any way to see the other user's mail details using the mail id/ credentials? If anybody has any idea please share.

Thanks in advance.

Gopal Biswas
  • 409
  • 1
  • 7
  • 34

1 Answers1

1

If your app is using OAuth code flow , it seems that only allow access to mail, calendar and contacts belonging to the authenticated user . You may use OAuth2 client credential flow, for your scenario and the app will be able to make calls to interact with any mailboxes in that tenant. Another choice is to use EWS Managed API ,since you get the password of the other user ,you will get the credentials like:

  ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
  service.Credentials = new WebCredentials("user_with_access@example.com", "password");

Check this thread for a demo.

Community
  • 1
  • 1
Nan Yu
  • 26,101
  • 9
  • 68
  • 148
  • Thank you for your valuable advice.Yes currently I'm using OAuth/ ADAL token cache.My requirement is like I need to send/delete/forward... office 365 mails from my own account and also viewing the o365 mail details for other users from my asp.net application.Should the OAuth2 client credential flow/ EWS Managed API could fulfill my all requirements? Please suggest me. – Gopal Biswas Mar 24 '16 at 05:11
  • 1
    Yes,please check [Outlook Mail REST API](https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations) and [EWS Managed API] (https://msdn.microsoft.com/en-us/library/office/dd633710(v=exchg.80).aspx) – Nan Yu Mar 28 '16 at 09:57