I'm writing a Windows service in C#. The service will write a TXT file in the user's My Documents
folder. Because every user will obviously have a different name, I'm using the methods in the documentation to get it. However, it's returning an empty string.
My insight so far from searching through SO is that it's because this service is running as system instead of user, which I intend for it to do. But how then can I get the path for the current logged in user's My Documents
folder?
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)