Reputation: 37192
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):
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 doesPKEY_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.
Upvotes: 18
Views: 3887
Reputation: 11
As a minor contribute I can add that while developing an UWP app I had the challenge to retrieve the status. What I found is: 14: available locally; 15: always available locally (still have to understand th difference with 14) 8: available on cloud.
Upvotes: 1
Reputation: 3284
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.Upvotes: 3