Azure-Samples / active-directory-dotnet-graphapi-console

A .NET console application that performs various queries against the Azure AD Graph API using both user identities and application identities.
79 stars 77 forks source link

How do you set a user's thumbnail with Graph API 2.0? #12

Closed SharePointRadi closed 9 years ago

SharePointRadi commented 9 years ago

Should one use User.SetExtendedProperty? 1.2 had this?

dkershaw10 commented 9 years ago

Here's a little code snippet that worked for me: FileStream fileStream = new FileStream(@"", FileMode.Open, FileAccess.Read); try { userToBeAdded.ThumbnailPhoto.UploadAsync((Stream) fileStream, "application/image").Wait(); Console.WriteLine("\nUser {0} was updated with a thumbnailphoto", userToBeAdded.DisplayName); } catch (Exception e) { Console.WriteLine("\nError Updating the user {0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""); }