I am developing Windows application to identify if this file cloud or local from OneDrive using c#.
OneDrive has three types file status like (Cloud, offline, always available on this device) from code how do I get file status of each file in OneDrive.
From what i have searched,API need user's account to log in Azure or something,can we not using API?
Please suggest.
Regards.
Yes, you can detect a file that is not downloaded to a local OneDrive folder by examining the file's attributes. OneDrive uses a flag to indicate that the file is just a placeholder. Unfortunately the particular flag is not one of those enumerated in
FileAttributesso you'll have to test it separately.A quick and dirty test for a OneDrive placeholder file looks something like this:
The longer version is that there are a few NTFS file attributes that dotnet doesn't support. From this list you'll find that the one we're interested in is called
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS (0x00400000). This is generally set only by kernel-level drivers, such as the one OneDrive uses to download file content on demand.