Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. //get actual photo
  2. var requestUserPhotoFile = client.Me.Photo.Content.Request();
  3. var resultUserPhotoFile = requestUserPhotoFile.GetAsync().Result;
  4.  
  5. //create the file
  6. var profilePhotoPath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "profilePhoto_" + resultsUserPhoto.Id + ".jpg");
  7. var profilePhotoFile = System.IO.File.Create(profilePhotoPath);
  8. resultUserPhotoFile.Seek(0, System.IO.SeekOrigin.Begin);
  9. resultUserPhotoFile.CopyTo(profilePhotoFile);
  10. Console.WriteLine("Saved file to: " + profilePhotoPath);
  11.  
  12. Console.WriteLine("\nGraph Request:");
  13. Console.WriteLine(requestUserPhoto.GetHttpRequestMessage().RequestUri);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement