Code to Setup Bind Credentials to Directory Stores
This section shows how to bind profiles to a specific user.
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.
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"
Bind to a user using a SAM Account Name.
oProfileService.BindAs "microsoft\someone", "mypassword"
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"
Clear the binding to access profiles not bound to a specific user.
oProfileService.Unbind