locked
DirectoryServices.AccountManagement User Profile, Profile path RRS feed

  • Question

  • User-1304029052 posted

    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

    Example:
    (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.

     

    Friday, April 24, 2009 5:46 AM

All replies

  • User1191518856 posted

    It doesn't appear to exist a typed property for this. I believe you need to use the ExtensionGet and ExtensionSet methods. Good luck!

    Monday, April 27, 2009 5:08 PM
  • User-2044266982 posted

    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
                        }

    Friday, January 22, 2010 5:07 PM