Created
February 24, 2020 07:18
-
-
Save JarbasHorst/3d75e2a0e1c28899580a9ee5c02fb6cc to your computer and use it in GitHub Desktop.
Get Office 365 using Microsoft Graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User user = null; | |
try | |
{ | |
user = await graphClient.Users[input].Request().GetAsync(); | |
} | |
catch (ServiceException ex) | |
{ | |
if (ex.StatusCode == HttpStatusCode.NotFound) | |
Console.WriteLine($"The user specified '{input}' is not a valid Office 365 user. Error message: {ex}"); | |
else | |
{ | |
throw ex; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment