title: Getting full file attributes for files managed by Microsoft OneDrive
body: <p>Microsoft OneDrive allows file to be stored either locally, remotely or in the both ways. This is determined by new file attributes which appeared in the Windows 10:</p>
  <pre><code>FILE_ATTRIBUTE_PINNED                0x00080000  
  FILE_ATTRIBUTE_UNPINNED              0x00100000  
  FILE_ATTRIBUTE_RECALL_ON_OPEN        0x00040000  
  FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS 0x00400000 
  </code></pre>
  <p>as well as some file attributes inherited from previous versions of Windows:</p>
  <pre><code>FILE_ATTRIBUTE_SPARSE_FILE           0x00000200
  FILE_ATTRIBUTE_REPARSE_POINT         0x00000400  
  FILE_ATTRIBUTE_OFFLINE               0x00001000      
  </code></pre>
  <p>Problem is that I cannot find a way to retrieve these new file attributes via Win32 API or NT Native API. I've tried so far:</p>
  <pre><code>GetFileAttributes()
  FindFirstFile()
  NtQueryAttributesFile()
  </code></pre>
  <p>For OneDrive file which was set to be stored always remotely, all these methods return 0x00500020 whilst true attributes are 0x00501620 (REPARSE_POINT, SPARSE_FILE and OFFLINE are masked out). True file attributes can be retrieved using the following PowerShell command:</p>
  <pre><code>[Convert]::ToString( (Get-ItemProperty -Path 'C:\Users\username\OneDrive\test.txt').Attributes.Value__, 16 )
  </code></pre>
  <p><code>attrib.exe</code> system command is also able to display some of these new OneDrive-related file attributes (<code>O</code> for offline, <code>U</code> for unpinned, <code>P</code> for pinned).</p>
  <p>Is there a way to retrieve these file attributes in my software? Maybe I need to add something to the manifest?</p>