One Drive Local Machine configuration Path

Copper Contributor

HI All,


I'm trying to get Microsoft OneDrive configured path (folder path) in local machine with help of C#. Is there any solution available to get the Local configured folder path, below are my script but its throwing error. Please help on this ..


             const string userRoot = "HKEY_CURRENT_USER";
             const string subkey = @"Software\Microsoft\OneDrive";
             const string keyName = userRoot + "\\" + subkey;
             string oneDrivePath = (string)Microsoft.Win32.Registry.GetValue(keyName,
               "Return this default if NoSuchName does not exist.");
             Console.WriteLine("\r\n OneDrivePath : {0}", oneDrivePath);
            string Onedrivepath= string.Format(oneDrivePath);
             label1 .Text = string.Format(Onedrivepath);
        catch (Exception)
            /// throw;


1 Reply
did you get what you required?