Last post Jan 22, 2010 05:07 PM by rjmcduff
Apr 24, 2009 05:46 AM|paulcreedy|LINK
Using windows forms for testing (will be converted to ASP.NET later)
I'm using the new 3.5 DirectoryServices.AccountManagement namespace to create, check, modify LDAP users.
I'm able to create a user with all the properties I need except one, the User profile profile path
(some fields removed for security)
Dim domainContext As PrincipalContext = New PrincipalContext(ContextType.Domain, "", "OU=")
Dim user As UserPrincipal = New UserPrincipal(domainContext, "Test user", "password", True)
user.DisplayName = "
user.EmailAddress = "test user@......"
user.GivenName = "first name"
user.Surname = "surname"
user.SamAccountName = "test user"
user.ScriptPath = "user.bat"
user.Name = "test user"
user.UserPrincipalName = "test user"
user.Description = ""
I need to be able to set the User profile profile path to a set location but I cannot find an appropriate property that I can use to set it.
Spent ages on google and various forums, but as this namespace is relatively new I can't find any example of using that property.
Apr 27, 2009 05:08 PM|johram|LINK
It doesn't appear to exist a typed property for this. I believe you need to use the ExtensionGet and ExtensionSet methods. Good luck!
Jan 22, 2010 05:07 PM|rjmcduff|LINK
Here's the snippet of my code that does the profile path for roaming profiles.
if (userPrincipal.GetUnderlyingObjectType() == typeof(DirectoryEntry))
DirectoryEntry entry = (DirectoryEntry)userPrincipal.GetUnderlyingObject();
ADlogonScript.Text = (string)entry.Properties["scriptPath"].Value; // script path
ADprofilePath.Text = (string)entry.Properties["profilePath"].Value; // profile path
Active Directory Roaming Profile Attribute