ProfileService.BindAs Method (PIA)

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

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Profiles
…
Public Sub BindAs(sUserName As String,
  sPassword As String)

[C#]

using Microsoft.CommerceServer.Interop.Profiles;
…
public void BindAs(stringsUserName,
  stringsPassword,
);

Parameters

[Visual Basic .NET]

  • sUserName
    A String that contains the user name for accessing ProfileObject objects.
  • sPassword
    A String that contains the password for accessing ProfileObject objects.

[C#]

  • sUserName
    A string that contains the user name for accessing ProfileObject objects.
  • sPassword
    A string that contains the password for accessing ProfileObject objects.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

The Errors property stores the collection of errors encountered in the last Profiles resource operation if an exception is thrown. 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 you could pass in any of the following:

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

For the 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.

[Visual Basic .NET]

Example

' oProfileService is a Commerce ProfileService object
oProfileService.BindAs("JoeUser@microsoft.com", "MyPassword123")
oProfileService.BindAs("DomainName\JoeUser", "MyPassword123")

Requirements

Namespace: Microsoft.CommerceServer.Interop.Profiles

Platforms: Windows 2000, Windows Server 2003

Assembly: mscsupslib (in mscsupslib.dll)

See Also

ProfileService Class

ProfileService.Unbind

Copyright © 2005 Microsoft Corporation.
All rights reserved.