Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // get photo
- GraphServiceClient graphClient = GetAuthenticatedGraphClient(...);
- var requestUserPhotoFile = graphClient.Me.Photo.Content.Request();
- var resultUserPhotoFile = requestUserPhotoFile.GetAsync().Result;
- // create the file
- var profilePhotoPath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "profilePhoto_" + resultsUserPhoto.Id + ".jpg");
- var profilePhotoFile = System.IO.File.Create(profilePhotoPath);
- resultUserPhotoFile.Seek(0, System.IO.SeekOrigin.Begin);
- resultUserPhotoFile.CopyTo(profilePhotoFile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement