SHARE
TWEET

Untitled

a guest Jan 29th, 2020 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // get photo
  2. GraphServiceClient graphClient = GetAuthenticatedGraphClient(...);
  3. var requestUserPhotoFile = graphClient.Me.Photo.Content.Request();
  4. var resultUserPhotoFile = requestUserPhotoFile.GetAsync().Result;
  5.  
  6. // create the file
  7. var profilePhotoPath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "profilePhoto_" + resultsUserPhoto.Id + ".jpg");
  8. var profilePhotoFile = System.IO.File.Create(profilePhotoPath);
  9. resultUserPhotoFile.Seek(0, System.IO.SeekOrigin.Begin);
  10. resultUserPhotoFile.CopyTo(profilePhotoFile);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top