c# - Get OneDrive path in Windows -
c# - Get OneDrive path in Windows -
i have c# wpf application , trying find way path root onedrive directory in windows. how can programmatically? have searched online, couldn't find anything. wish supply code have no clue; mean, have checked scheme environment variables , couldn't find on machine, thinking valid solution, didn't turn anything.
on windows 8.1 computer, registry key holds info is: hkey_current_user\software\microsoft\windows\currentversion\skydrive\userfolder
i'd seek using registry.getvalue()
method:
const string userroot = "hkey_current_user"; const string subkey = @"software\microsoft\windows\currentversion\skydrive"; const string keyname = userroot + "\\" + subkey; string onedrivepath = (string)registry.getvalue(keyname, "userfolder", "return default if nosuchname not exist."); console.writeline("\r\n onedrivepath : {0}", onedrivepath);
i found path under:
hkey_local_machine\software\microsoft\windows\currentversion\explorer\syncrootmanager\skydrive\usersyncroots\s-1-5-21-2696997101-1021499815-432504798-1004
hkey_users\s-1-5-21-2696997101-1021499815-432504798-1004\software\microsoft\windows\currentversion\skydrive\userfolder
c# .net wpf path onedrive
Comments
Post a Comment