public async Task <string> GetUserPhoto(string userId) { var MSGraph = new MSGraphApiService(new AppClient()); string mediaType = ""; string thumbnail = ""; //Recupera informações sobre o perfil do usuario atraves do email Response responseQuery = await MSGraph.GetPhoto <ProfilePhoto>(userId); var response = responseQuery.HttpResponse; if (response.IsSuccessStatusCode) { // Read the response as a byte array var responseBody = response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult(); // The headers will contain information on the image type returned mediaType = response.Content.Headers.ContentType.MediaType; // Encode the image string thumbnail = Convert.ToBase64String(responseBody); } return($"data:{mediaType};base64,{thumbnail}"); }
public async Task <JsonResult> GetUserInfo() { var MSGraph = new MSGraphApiService(new AppClient()); //Recupera informações sobre o perfil do usuario atraves do email Response responseQuery = await MSGraph.GetUser <User>(HttpContext.User.Identity.GetUserName()); var user = responseQuery.Data; if (user.IsValid()) { return(Json(user)); } else { return(Json(new User() { GivenName = "Erro", Response = responseQuery.HttpResponse })); } }
public Form1() { InitializeComponent(); MSGraph = new MSGraphApiService(new AppClient()); }
static void Main(string[] args) { var _graphClient = new MSGraphApiService(new AppClient()); var usr = _graphClient.GetUser <User>("*****@*****.**"); var OfficeUser = usr.Result; }
public AuthController() { _graphService = new MSGraphApiService(new AppClient()); }
static void Main(string[] args) { var _graphClient = new MSGraphApiService(new AppClient()); var usr = _graphClient.GetUser <Microsoft.Graph.Message>(); var OfficeUser = usr.Result; }
public MSGraphUserService(string email) { _email = email; _graphClient = new MSGraphApiService(AccessTokenConfig.AccessToken); GetUserAsync(); }
public MSGraphUserService() { _graphClient = new MSGraphApiService(new AppClient()); }