title: Ms graph: get user by id
body: <p>I need to get the user, who created and shared file.
  To get user by id I call the endpoint <code>GET /users/{id}</code>: <a href="https://docs.microsoft.com/en-us/graph/api/user-get" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/graph/api/user-get</a></p>
  
  <p>But instead file owner the endpoint returns current logged in user info.</p>
  
  <p>I have two assumptions:</p>
  
  <ol>
  <li>incorrect user id</li>
  <li>incorrect permissions</li>
  </ol>
  
  <p><strong>1. User id</strong>. I got it from remoteItem.createdBy.user.id, where user is <a href="https://docs.microsoft.com/en-us/graph/api/resources/identity." rel="nofollow noreferrer">Identity object</a> and contains next properties:</p>
  
  <pre><code>{ displayName: '', id: '' }
  </code></pre>
  
  <p>There is a remark in the documentation:</p>
  
  <blockquote>
    <p>In some circumstances, the unique identifier for the actor may not be available. In this case, the displayName property for the identity will be returned, but the id property will be missing from the resource.</p>
  </blockquote>
  
  <p>Well, maybe existing displayName means that id is incorrect? How to get owner user in this case?</p>
  
  <p><strong>2. Permissions</strong>. I've tried next permissions:</p>
  
  <ul>
  <li>Files.Read.All (Application/Delegated)</li>
  <li>User.Read.All (application/Delegated)</li>
  </ul>
  
  <p>Any help is highly appreciated. thanks!</p>