ProfileService.GetProfile Method (PIA)

Use this method to retrieve the ProfileObject object corresponding to the specified primary key value and schema type.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Profiles
…
Public Function GetProfile(sValue as Object,
  bstrType As StringOptionalbReturnError As Boolean) As IProfileObject

[C#]

using Microsoft.CommerceServer.Interop.Profiles;
…
public IProfileObject GetProfile(objectsValue,
  stringbstrType,
  boolbReturnError);

Parameters

[Visual Basic .NET]

  • sValue
    An Object that contains the primary key value. The variable types permitted for this object are String or Integer.
  • bstrType
    A String that contains the profile schema type.
  • bReturnError
    An optional Boolean. The default value is True.

[C#]

  • sValue
    An object that contains the primary key value. The variable types permitted for this object are string or int.
  • bstrType
    A string that contains the profile schema type.
  • bReturnError
    See Remarks for a description of this parameter.

Return Values

[Visual Basic .NET] This method returns an object that implements the IProfileObject interface corresponding to the specified primary key value and schema name.

[C#] This method returns an object that implements the IProfileObject interface.

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

If the bReturnError parameter is set to true and the specified ProfileObject object is not found, the method throws a COMException with a value of E_PS_PROFILE_NOTEXISTS instead of returning an object reference.

If the bReturnError parameter is set to false and the specified ProfileObject object is not found, an empty ProfileObject object is returned.

Properties with the IsCached attribute set to false are not loaded by this method.

The Fields property of the returned ProfileObject object provides access to the profile properties.

Use the GetProfileByKey method to retrieve a profile by specifying a key member name/value pair and schema type.

Call the Initialize method before you use this ProfileService method.

[Visual Basic .NET]

Example

' oProfileService is a Commerce ProfileService object
' oProfileObject is a Commerce ProfileObject object

oProfileObject = oProfileService.GetProfile("Joeuser@microsoft.com", _
 "UserObject")

Requirements

Namespace: Microsoft.CommerceServer.Interop.Profiles

Platforms: Windows 2000, Windows Server 2003

Assembly: mscsupslib (in mscsupslib.dll)

See Also

ProfileService Class

ProfileService.GetProfileByKey

ProfileService.Initialize

ProfileObject Class

ProfileObject.Fields

Copyright © 2005 Microsoft Corporation.
All rights reserved.