Hello Peter Dräxler,
Thank you for reaching out to Microsoft Support!
For your question, we did the same test, but the test results are all good, the test code is as follows:
var photoStream = await graphClient.Users["******@xxxxxxxxxxxxx.OnMicrosoft.com"].Photo.Content.GetAsync();
// Step 2: Save the photo to a file
using (var fileStream = new FileStream("photo.jpg", FileMode.Create, FileAccess.Write))
{
await photoStream.CopyToAsync(fileStream);
}
// Step 3: Print the photo
System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
printDocument.PrintPage += (sender, e) =>
{
System.Drawing.Image image = System.Drawing.Image.FromFile("photo.jpg");
e.Graphics.DrawImage(image, new Point(0, 0));
};
printDocument.Print();
For your error, it is recommended that you check whether the user_id is correct, according to the documentation needs to note the following:
Finally, you can test it in Graph Explorer to see if you get the same error.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.