SHGetFolderPath

[DllImport("shell32.dll", CharSet = CharSet.Unicode)]
public static extern int SHGetFolderPath(
   IntPtr hwndOwner,
   int nFolder,
   IntPtr hToken,
   uint dwFlags,
   StringBuilder lpszPath
);

Microsoft documentation: Link

Last updated