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 on this device
Always available on this device
Syncing / downloading
ErrorThe 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_EMPTYPKEY_OfflineStatus returns VT_EMPTYPKEY_FilePlaceholderStatus returns an undocumented value (0xe) but it doesn't change when the status doesPKEY_FileOfflineAvailabilityStatus returns VT_EMPTYI 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.
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.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With