Get OneDrive path in Windows

Alexandru picture Alexandru · Nov 6, 2014 · Viewed 18.7k times · Source

I have a C# WPF application and I am trying to find a way to get the path to the root OneDrive directory in Windows. How can I do this programmatically? I have searched online, but I couldn't find anything. I wish I could supply some code but I have no clue; I mean, I have checked system environment variables and I couldn't find anything on my machine, thinking that could be a valid solution, but it didn't turn up anything.

Answer

mmichtch picture mmichtch · Apr 26, 2017

With latest update for windows 10, Microsoft introduced new environment variable %OneDrive%, I have checked it on April 2017 update (Creators update) and it is there.