Code to Setup Bind Credentials to Directory Stores

This section shows how to bind profiles to a specific user.

  1. If not already connected, create a ProfileService object, oProfileService, and establish a connection to the Profile Store. For information about connecting to the Profile Store, see Code to Connect to the Profile Store.

  2. Bind to a user using the full User Principal Name (UPN). Any profiles created after this binding will only be accessible by the user with the credentials user name = "someone@microsoft.com" and password = "mypassword".

    oProfileService.BindAs "someone@microsoft.com", "mypassword"
    
  3. Bind to a user using a SAM Account Name.

    oProfileService.BindAs "microsoft\someone", "mypassword"
    
  4. Bind to a user using the fully specified distinguished name of the security principal.

    oProfileService.BindAs "CN=someone,CN=Users,DC=microsoft,DC=com", _
     "mypassword"
    
  5. Clear the binding to access profiles not bound to a specific user.

    oProfileService.Unbind
    

Copyright © 2005 Microsoft Corporation.
All rights reserved.