Problem with Windows 7 Libraries

M

Marc Allard

Hello,

I have installed Windows 7 RTM on a computer and I have changed the My
documents libraries (to the D:\Documents\ so in case of a crash with Windows,
I don't lose my documents if I need to reformat the c:. The default save
location is (of course) put in the d:\Documents\ folder (the old one has been
removed from libraries)

Now, in .NET 2008, I want to see the path where my Documents is saved. So I
do a
My.Computer.FileSystem.SpecialDirectories.MyDocuments and I expect it is be
in d:\Documents\
But is is still in c:\Users\UserName\Documents
What can I do?
If my customers says that the Documents folder is in d:\...., he expects my
program to save all the files in this directory.
Did I expect too much of the libraries? Is there a possibility to have the
correct path in .NET?
I use some softwares that all use the wrong Documents folder (because of
that problem I think).

Thank you
Marc
 
N

Niko Suni

Please describe, in detail, the steps you took in "changed the my documents
libraries to d:\documents\".

-Niko
 
M

Marc Allard

Hello,


Does any one have an idea?
Am I in the managed MSDN forums? or did I choose a wrong option?

Thank you
Marc
 
P

Peter Duniho

Does any one have an idea?
Am I in the managed MSDN forums? or did I choose a wrong option?

If you have an MSDN subscription, I think maybe this is no longer the
right forum. Microsoft used to answer MSDN subscriber questions here, but
I seem to recall seeing a recent message saying that they'd moved their
managed support over to a web-based forum. Sorry I don't have more
specifics about that.

As for your question, I believe that your problem is probably more user
error than anything else. I've tested and verified that when I change the
"My Documents" location, the .NET
Environment.GetFolderPath(SpecialFolder.MyDocuments) as well as the
VB-specific FileSystem.SpecialDirectories.MyDocuments both return the
correct folder location. (See below for a concise-but-complete code
example).

So, I can only conclude that you are not actually changing your "My
Documents" folder correctly.

In Windows 7, you need to expand the "Documents" item in the navigation
pane, right-click on the "My Documents" item, choose "Properties" and then
go to the "Location" tab in the "Properties" dialog. There, you can click
the "Move..." button to change the location of that special folder.

If the above information does not help, then you need to post a more
specific question. Post a concise-but-complete code example that shows
exactly how you're retrieving the "My Documents" folder path, as well as a
clear, specific description of how you're changing "the My Documents
libraries" in Windows Explorer.

Pete



using System;
using Microsoft.VisualBasic.Devices;

namespace TestDocumentsSpecialFolder
{
class Program
{
static void Main(string[] args)
{
// The .NET way:
Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));

// The VB way:
Computer computer = new Computer();
Console.WriteLine(computer.FileSystem.SpecialDirectories.MyDocuments);
}
}
}
 
M

Marc Allard

Hello,

Thank you for your answer.
I saw there forums from the link "Managed newsgroup" in my msdn suscription.
For the error, I have tried with your code and it still doesn't work.

Code (VB.NET)
' Your code
Dim computer As Devices.Computer = New Devices.Computer()
Console.WriteLine(computer.FileSystem.SpecialDirectories.MyDocuments)

' My code
Debug.Print(My.Computer.FileSystem.SpecialDirectories.MyDocuments)

In every case, I have C:\Users\UserName\Documents.
When I look at the libraries, I have
Libraries
Documents
Public Documents
My Documents (d:\)

If I do a Right click / Properties on Documents (the top one, not My
Documents) to have the list of documents
I have
Public documents (c:\Users\Public)
V My Documents (d:\MarcDatas) (with a V before as it is the default save)


After doing some tests, I have seen my problem.
To move the My Documents folder, I have added the new location in the
libraries, and I have removed the old one. All seems to be OK (as you can see
in the libraries).
Now I have added the old location back and I did like you told me and now it
is working.


Thank you again
Marc

Peter Duniho said:
Does any one have an idea?
Am I in the managed MSDN forums? or did I choose a wrong option?

If you have an MSDN subscription, I think maybe this is no longer the
right forum. Microsoft used to answer MSDN subscriber questions here, but
I seem to recall seeing a recent message saying that they'd moved their
managed support over to a web-based forum. Sorry I don't have more
specifics about that.

As for your question, I believe that your problem is probably more user
error than anything else. I've tested and verified that when I change the
"My Documents" location, the .NET
Environment.GetFolderPath(SpecialFolder.MyDocuments) as well as the
VB-specific FileSystem.SpecialDirectories.MyDocuments both return the
correct folder location. (See below for a concise-but-complete code
example).

So, I can only conclude that you are not actually changing your "My
Documents" folder correctly.

In Windows 7, you need to expand the "Documents" item in the navigation
pane, right-click on the "My Documents" item, choose "Properties" and then
go to the "Location" tab in the "Properties" dialog. There, you can click
the "Move..." button to change the location of that special folder.

If the above information does not help, then you need to post a more
specific question. Post a concise-but-complete code example that shows
exactly how you're retrieving the "My Documents" folder path, as well as a
clear, specific description of how you're changing "the My Documents
libraries" in Windows Explorer.

Pete



using System;
using Microsoft.VisualBasic.Devices;

namespace TestDocumentsSpecialFolder
{
class Program
{
static void Main(string[] args)
{
// The .NET way:
Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));

// The VB way:
Computer computer = new Computer();
Console.WriteLine(computer.FileSystem.SpecialDirectories.MyDocuments);
}
}
}
 
M

Marc Allard

Hello,

Here is what I did

To move the My Documents folder, I have added the new location (My Documents
name too) in the libraries(on the d:), and I have removed the old one from
the libraries. All seemed to be OK (as I can see My documents in the
libraries). I expected it to work as (for me), My Documents had to be the
default place where I want to save the documents. It didn't work, and it kept
using c:\.....

Now, I have added the My documents folder from the c:\.....
After that, I have chosen the option to move it and now, it is working as
expected.


Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top