1)
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
2)
Or the extreme way what is actually done by the GetFolderPath method but
with less checking
[DllImport("shfolder.dll", CharSet=CharSet.Auto)]
internal static extern int SHGetFolderPath(IntPtr hwndOwner, int
nFolder, IntPtr hToken, int dwFlags, System.Text.StringBuilder
lpszPath);
[STAThread]
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder(260);
SHGetFolderPath(IntPtr.Zero, 5, IntPtr.Zero, 0, sb);
Console.WriteLine(sb);
Console.Read();
}
Gabriel Lozano-Morán
What is the best method to obtain the actual folder path to My
Documents for the current logged in user in C#?
Thanks,
Yosh