User Profile
jvl-dk
Copper Contributor
Joined May 08, 2019
User Widgets
Recent Discussions
Re: How to get user photo in C# using Graph API?
Atul Moghe WIth recent updates to Microsoft.Graph api (summer 2020), this approach is pretty clean: public static async Task<System.Drawing.Image> GetMePhotoAsync() { try { // GET /me Stream photoresponse = await graphClient.Me.Photo.Content.Request().GetAsync(); if (photoresponse != null) { MemoryStream ms = new MemoryStream(); photoresponse.CopyTo(ms); System.Drawing.Image i = System.Drawing.Image.FromStream(ms); return i; } else { return null; } } catch (ServiceException ex) { Console.WriteLine($"Error getting signed-in user profilephoto: {ex.Message}"); return null; } }44KViews1like0Comments
Recent Blog Articles
No content to show