I'm actually making a little application that can find on any computer the list of the different cloud storage installed and i wonder how i can get the path to the Skydrive folder in C#.
I managed to get the path of dropbox and google drive with information stored in appdata/roaming folder but i don't manage to do the same thing with Skydrive.
For dropbox:
string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string dbPath = System.IO.Path.Combine(appDataPath, "Dropbox\\host.db"); string[] lines = System.IO.File.ReadAllLines(dbPath);
byte[] dbBase64Text = Convert.FromBase64String(lines[1]);
string folderPath = System.Text.ASCIIEncoding.ASCII.GetString(dbBase64Text);
For google drive :
String dbFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Google\\Drive\\sync_config.db");
File.Copy(dbFilePath, "temp.db", true);
String text = File.ReadAllText("temp.db", Encoding.ASCII);
// The "29" refers to the end position of the keyword plus a few extra chars
String trim = text.Substring(text.IndexOf("local_sync_root_pathvalue") + 29);
// The "30" is the ASCII code for the record separator
String drivePath = trim.Substring(0, trim.IndexOf(char.ConvertFromUtf32(30)));
If you want to get the path to the skydrive folder you need to use the Registery value at HKEY_CURRENT_USER\Software\Microsoft\SkyDrive, with the name UserFolder. Here is the code :
String SkyDriveFolder = Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\SkyDrive", "UserFolder",null).ToString();