IProfileService2::BindAs Method [C++]

Use this method to set the credentials used to access ProfileObject objects in the underlying Profiles store.

Definition

[C++]

HRESULT IProfileService::BindAs(BSTRsUserName,
  BSTRsPassword,
);

[Visual Basic]

Sub BindAs(sUserName As String,
  sPassword As String)

Parameters

  • sUserName [C++]
    [in] A BSTR that contains the user name for accessing ProfileObject objects.
  • sUserName [Visual Basic]
    [in] A String that contains the user name for accessing ProfileObject objects.
  • sPassword[C++]
    [in] A BSTR that contains the password for accessing ProfileObject objects.
  • sPassword[Visual Basic]
    [in] A String that contains the password for accessing ProfileObject objects.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] None.

Error Values

[C++] The Errors property stores the collection of errors encountered in the last Profiles resource operation. For more information, see IProfileService::get_Errors.

[Visual Basic] The Errors property stores the collection of errors encountered in the last Profiles resource operation. For more information, see ProfileService.Errors.

Remarks

This method sets the credentials used to access and modify ProfileObject objects in the underlying directory store. Any new ProfileObject objects or modifications will be bound to these credentials. The specified credentials define the security context under which all subsequent ProfileObject object operations will be performed, until the UnBind method is invoked. The credentials specified here will be used as is to bind to the underlying directory stores. It is the responsibility of the client to pass in these credentials in the appropriate format. For example, to bind to Active Directory one could pass in either the

  • Full User Principal Name (UPN) (for example, joeuser@domain.com), or
  • SAM Account Name (for example, Domain\SAMAccountName), or
  • Fully specified distinguished name of the security principal (for example, CN=joeuser, CN=Users, DC=Domain, DC=com).

For Membership Directory, you must specify the fully specified distinguished name of the security principal.

Use the UnBind method to clear the credentials.

Call the Initialize method before you use this ProfileService method.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

' oProfileService is a Commerce ProfileService object

oProfileService.BindAs "JoeUser@microsoft.com", "MyPassword123"
oProfileService.BindAs "DomainName\JoeUser", "MyPassword123"

See Also

[C++]ProfileService Object

[C++]IProfileService::UnBind

[Visual Basic]ProfileService Object

[Visual Basic]ProfileService.UnBind

Copyright © 2005 Microsoft Corporation.
All rights reserved.