Search code examples
windows-8.1onedrive

API to check OneDrive file status


Is there an API in Windows 8.1 to check the status of a OneDrive file? I would like to know whether the file has been replicated to the local disk or it is just a dummy representation of a file in the cloud that doesn't take up local disk space


Solution

  • This information can be retrieved by calling StorageFile.Properties.RetrievePropertiesAsync() (http://msdn.microsoft.com/en-us/library/windows/apps/hh770652.aspx)

    method and passing it "System.OfflineAvailability" (http://msdn.microsoft.com/en-us/library/windows/desktop/bb787532(v=vs.85).aspx)

    in the list of properties to be retrieved.

    Function will return a dictionary that will contain one of the 3 possible values: 0 - not available offline 1 - available offline 2 - not applicatble (not a SkyDrive/OneDrive file)