views:

529

answers:

1

I have a small application I am working on that at one point needs to update a user's home directory path in AD under the profile tab where it allows you to map a drive letter to a particular path. The code I have put together so far sets the Home Folder Local path portion OK, but I'm trying to figure out the name for the "connect" portion, as well as how to select the drive letter. Go easy on me, I'm new to C#. Thanks!!

Here's my code that updates the Local path section.

        DirectoryEntry deUser = new
                DirectoryEntry(findMeinAD(tbPNUID.Text));
                deUser.InvokeSet("HomeDirectory", tbPFolderVerification.Text);
                deUser.CommitChanges();

Where findMeinAD is a method that looks up a user's info in AD and tbPFolderVerification.Text is a text box in the form that contains the path I'd like to set a particular drive to map to.

+1  A: 

You may need to set the HomeDrive property as well:

DirectoryEntry deUser = new DirectoryEntry(findMeinAD(tbPNUID.Text));
deUser.InvokeSet("HomeDirectory", tbPFolderVerification.Text);
deUser.InvokeSet("HomeDrive", "Z:");
deUser.CommitChanges();
Sam
Thanks for such a fast response :) It made sense as soon as I read what you said, although for some reason even when I try setting the home drive, the path still gets inserted under local path for some reason. Not sure what I'm doing wrong here. thx again
unrealtrip
A typo above caused my failure, you were right that did the trick, thank you! :)
unrealtrip