VB.net Getting "My Documents folder on company network

Hi

I use the following code to get the "My Documents" folder

Dim MD as string = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)

When I install my application on certain users machines on a company network it finds a drive on the network eg "F:" instead
of the usual "My Documents" folder on the C drive.

Why would this be?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ChloesDadCommented:
You can change the location of mydocuments to point to a folder on a network drive in the user settings. This is often done on networks so that users can work at any workstation and still have access to MyDocuments.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks. Is there code that I can use that only looks for the "My Documents" folder on your C drive?
Jacques Bourgeois (James Burger)PresidentCommented:
You cannot find "My Documents" with certitude if MyDocuments was changed to point somewhere else than the default.

The default name of that folder changes from one version of Windows to another ("Documents" in newer versions, "My Documents" in older ones). It will also change depending on the language of the OS ("My Documents" in English, but "Mes Documents" in French).

Same thing for its location ("C:\User\<UserName>\Documents" or "C:\Utilisateurs\<UserName>\Documents in recent versions, something like "Documents and Settings" in older versions.

This is why Microsoft has given us a way to retrieve it with through GetFolderPath. It reads the system registry to retrieve what was defined as being MyDocuments on the current computer. If the system registry was changed to point to F:, then this is what is considered as My Documents, and the concept of a local My Documents becomes irrelevant on the C: drive. All the Windows programs that follow the rules will go to F:. Your application should usually also follow that path.
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.