Determine whether a given path is a sync folder / cloud folder

Peter Bons 20 Reputation points

I have some difficulties to determine whether a given path is a sync folder. With that I mean whether the path is synced by a service like One Drive, Google Drive, DropBox etc.

I've tried it using the StorageFolder like this:

var folder = await StorageFolder.GetFolderFromPathAsync(args[0]);
var info = StorageProviderSyncRootManager.GetSyncRootInformationForFolder(folder);

folder = info.Path as StorageFolder;

var props = await folder?.Properties.RetrievePropertiesAsync(new[]
foreach (var prop in props)
    Console.WriteLine($"{prop.Key}: {prop.Value}");

but this seems to target One Drive only, not Google Drive for example. Also, it shows results on my windows 11 machine but not on that of a collegue.

Are there any other options I am not aware of?

Microsoft Technologies based on the .NET software framework.
3,367 questions
A Microsoft file hosting and synchronization service.
805 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,233 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Osjaetor 475 Reputation points

    Hi Peter Bons,

    The best way to determine if a folder is synchronized with services such as OneDrive, Drive or Dropbox, is to use the API or SDK that they provide.

    For OneDrive: You can use the Microsoft Graph API to retrieve the folder metadata and check if the remoteItem property includes fileSystemInfo with the lastModifiedBy property representing OneDrive.

    For Google drive: you can use the Google Drive API. Perform a Files: list request to retrieve the folder metadata. Check if the ownedByMe field is true, which indicates that the folder is synchronized with Google Drive.

    For Dropbox: you must use the Dropbox API. Make a files/get_metadata request to retrieve the folder's metadata. Check if the sharing_info field is present, indicating that the folder is synchronized with Dropbox.


    0 comments No comments