Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query OneDrive sync status for a given file

Now that Microsoft have reinstated OneDrive in the file system in Windows 10 (and assuming they don't drop it again in 6 months time), I'm looking for how to determine the sync status of an arbitrary file.

There are at least five different states shown in Explorer (this is just what I've observed, there may be others):

  • Available when online Available when online
  • Available on this device Available on this device
  • Always available on this device Always available on this device
  • Syncing / downloading Syncing / downloading
  • Error Error

The first two states, for a file, can be determined using the FILE_ATTRIBUTE_OFFLINE attribute.

It seems that the "Always available" state can be determined for a file using a new, undocumented file attribute 0x00080000.

Determining these states for folders, and the syncing and error states for both files and folders, however remains a mystery.

My first thought was using the property system (IPropertyStore), but the following four property keys all failed to help:

  • PKEY_OfflineAvailability returns VT_EMPTY
  • PKEY_OfflineStatus returns VT_EMPTY
  • PKEY_FilePlaceholderStatus returns an undocumented value (0xe) but it doesn't change when the status does
  • PKEY_FileOfflineAvailabilityStatus returns VT_EMPTY

I have a feeling this is going to turn out to be just another undocumented Microsoft API but I thought I'd ask to see if anyone has any suggestions.

like image 381
Jonathan Potter Avatar asked Dec 06 '25 02:12

Jonathan Potter


1 Answers

I tried reverse-engineering it on Windows 11 22H2 and this is what I found:

Two properties appear different when a file is still syncing:

  • System.FilePlaceholderStatus is 15 when done, and 7 when still syncing. E.g. 0x8 bit set == done syncing.
  • System.SyncTransferStatusFlags is 1 when syncing and is 0 or null otherwise.
like image 146
LOST Avatar answered Dec 07 '25 18:12

LOST



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!