Skip to content

Instantly share code, notes, and snippets.

@JarbasHorst
Created February 24, 2020 07:18
Show Gist options
  • Save JarbasHorst/3d75e2a0e1c28899580a9ee5c02fb6cc to your computer and use it in GitHub Desktop.
Save JarbasHorst/3d75e2a0e1c28899580a9ee5c02fb6cc to your computer and use it in GitHub Desktop.
Get Office 365 using Microsoft Graph
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