user311509
user311509

Reputation: 2866

How Can i Fetch a Customized Folder Path using GetFolderPath?

string downloadArea = Environment.GetFolderPath((Environment.SpecialFolder.MyDocuments) + "\\My Personal Documents\\CVs");

I'm trying to get the path ends with .....\My Personal Documents\CVs

My Personal Documents and CVs are folders that reside under MyDocuments.

The above code gives me a compiler error that says:

The best overloaded method match for 'System.Environment.GetFolderPath(System.Environment.SpecialFolder)' has some invalid arguments

Another error:

Argument '1': cannot convert from 'string' to 'System.Environment.SpecialFolder'

Any help will be appreciated

Upvotes: 2

Views: 1480

Answers (1)

Chris Schmich
Chris Schmich

Reputation: 29476

Get the special "My Documents" folder path first, then append your additional directories with Path.Combine:

string myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string downloadArea = Path.Combine(myDocuments, "My Personal Documents", "CVs");

Upvotes: 3

Related Questions