Access Denied When Using StorageProviderSyncRootManager

Luke Blevins 6 Reputation points
2020-11-05T17:12:37.173+00:00
if (StorageProviderSyncRootManager.IsSupported())
{
     var syncRoots = StorageProviderSyncRootManager.GetCurrentSyncRoots();
     foreach(StorageProviderSyncRootInfo syncRootInfo in syncRoots)
     {
           var cloudStorageItem = new DriveItem()
           {
                Root = syncRootInfo.Path as StorageFolder,
                Text = syncRootInfo.DisplayNameResource,
                VirtualDriveIconPath = syncRootInfo.IconResource,
                Path = syncRootInfo.Path.Path,
                Type = DriveType.VirtualDrive,
            };
            list.Add(cloudStorageItem);
      }
}

Unfortunately, this code returns an ACCESS_DENIED on the first line. I have broadFileSystemAccess capability granted and the Desktop Extension properly referenced in my app manifest. Other people online are having this same problem, so I'd prefer someone knowledgeable with WinRT answer this one.

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Ben Polinsky 1 Reputation point
    2021-07-16T13:02:54.2+00:00

    Update:
    Actually, it seems the call queries HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, then other HKCU paths. This seems to be the issue.

    Check your Registry permissions for

    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager

    0 comments No comments