Share via


IProfileService2::BindAs Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

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

HRESULT IProfileService::BindAs(
  BSTR sUserName,
  BSTR sPassword
);
Sub BindAs(
    sUserName As String,
    sPassword As String
)

Parameters

  • sUserName
    [C++]

    [in] A BSTR that contains the user name for accessing ProfileObject objects.

    A String that contains the user name for accessing ProfileObject objects.

  • sPassword
    [C++]

    [in] A BSTR that contains the password for accessing ProfileObject objects.

    A String that contains the password for accessing ProfileObject objects.

Return Value

[C++]

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

None.

Error Values

The Errors property stores the collection of errors encountered in the last Profiles resource operation. For more information, see IProfileService::get_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 caller 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.

Example

' oProfileService is a Server ProfileService object.

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

See Also

Other Resources

ProfileService Object

IProfileService2::Unbind Method