title: Microsoft.Graph.ServiceException when trying to download user image
body: <p>I have a really frustrating issue, where all I want to do is get user images from O365 and simply display them on my web page, which is hosted on Azure azpp service.</p>
  
  <p>As you can see from <a href="https://stackoverflow.com/questions/49021773/images-on-sharepoint-not-loading-after-publish">this SO</a> and <a href="https://sharepoint.stackexchange.com/questions/237012/images-fail-to-load-after-publish-but-do-load-after-manuall-navigating-to-the-i">this SharePoint.StackExchange</a> question, The images fail to load when simply trying to display the link taken from SharePoint in an <code>&lt;img&gt;</code> tag.</p>
  
  <p><strong>However</strong>, after navigating to the image in a a new tab, and refreshing my page, the iamges load fine. <strong>can anyone explain this behaviour? it makes no sense to me at all</strong></p>
  
  <p>Anyways since that just dont work for whatever reason (logged in user clearly has the right permissions, as the images do disaply after navigating to them),
   I thought I would try downloading the images using graph API. </p>
  
  <p>SO I downloaded the <a href="https://developer.microsoft.com/en-us/graph/quick-start" rel="nofollow noreferrer">quick start project</a> and trying to download the iamges with</p>
  
  <pre><code>public async Task&lt;Stream&gt; TestAsync(GraphServiceClient graphClient)
  {
      var users = graphClient.Users;
      var jk = users["user.name@domain.com"];
  
      return await jk.Photo.Content.Request().GetAsync();
  }
  </code></pre>
  
  <p>But I just get </p>
  
  <blockquote>
    <p>Exception of type 'Microsoft.Graph.ServiceException' was thrown.</p>
  </blockquote>
  
  <p>Yet when I try to view the same image in the API graph explorer, I can download the image. Please can someone just help me to display SharePoint user images in my web page without the user having to first navigate to the image directly.. Why must it be so difficult?</p>