I want to check the status (Available when online/ Available on this device) of files residing in OneDrive folder either using C# or PowerShell. I want to check whether file is available on disk, basically check the sync status of files or folder.
Is there any possible way to get this status?
The dll mentioned in this thread is good, but I don't want to have to distribute that to everyone's machines, so I came up with an alternative. The script that follows would check OneDrive for a folder called Documents and returns its status.
# ID 303 = "Availability status" | The status is generally one of the following...
# "Always available on this device", "Available on this device", "Available when online"
$OneDriveDocs = "$env:OneDrive\Documents"
$Shell = (New-Object -ComObject Shell.Application).NameSpace((Split-Path $OneDriveDocs))
$Status = $Shell.getDetailsOf($Shell.ParseName((Split-Path $OneDriveDocs -Leaf)),303)