-2

I have to read Outlook emails from an inbox in a Windows Console Application. I am trying to use MS Graph Client for the same. Problem is I don't want to login to generate access token. How should I go about generating access token without a login form ? I will appreciate any help.

I have tried the solution given in this article, but couldn't get it working as I didn't know redirectUrl and couldn't resolve some references for the given code.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Kanu Priya
  • 77
  • 1
  • 8
  • I'm not sure I like the idea of an external process being able to read emails willy nilly. Anyway your question is _too broad_ sadly. [ask] –  Apr 03 '19 at 06:11
  • Your question isn't very specific. Is it meant to be without a user present (like an application access), or you want a way for the user to grant a one time permission for your application? – Stephan Apr 11 '19 at 09:27
  • @Stephan It is meant to be without a user present. – Kanu Priya Apr 11 '19 at 09:28
  • entire organization or single specific user? – Stephan Apr 11 '19 at 09:32
  • @Stephan I believe it is for entire organization. Actually, I am developing a Windows Console Application where one needs to read the emails of one mailbox. Presently, I am using Exchange Webservice, but I want to move to MS Graph API. I am new to Graph API. Is it required to be for single specific user ? – Kanu Priya Apr 11 '19 at 09:38

1 Answers1

0

Single user -> Use device code flow

If you want to access the mailbox of a single user: you can use the Device code flow documentation.

This flow allows you to display a code to the user, they go to the device login page and authorize your application. You also get a refresh token so this access can be used for a log time.

Any user in organization -> Use client credentials

If you want to access any mailbox of the entire organisation you can check out this answer and replace the required permission by Read mail in all mailboxes.

Stephan
  • 2,356
  • 16
  • 38
  • @kany-priya can you let us know if this answer helped you? It's always nice to let people know if it helped. – Stephan Jul 08 '20 at 10:08