Share via


IProfileService2::GetProfile Method

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

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

HRESULT IProfileService::GetProfile(
  VARIANT sValue,
  BSTR bstrType,
  VARIANT_BOOL bReturnError,
  IProfileObject** ppProfileObject
);
Function GetProfile(
    sValue as Variant,
    bstrType As StringOptional,
    bReturnError As Boolean
) As Object

Parameters

  • sValue
    [C++]

    [in] A VARIANT that contains the primary key value.

    [Visual Basic]

    A Variant that contains the primary key value.

  • bstrType
    [C++]

    [in] A BSTR that contains the profile schema type.

    [Visual Basic]

    A String that contains the profile schema type.

  • bReturnError
    [C++]

    [in, optional, defaultvalue (-1)] An optional VARIANT_BOOL.

    [Visual Basic]

    An optional Boolean. The default value is True (-1).

  • ppProfileObject
    [C++]

    [out, retval] The address of a pointer to the IProfileObject interface of the returned ProfileObject object.

Return Value

[C++]

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

[Visual Basic]

If this method completes successfully, it returns a ProfileObject object corresponding to the specified primary key value and schema name.

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

If the optional bReturnError parameter is set to True (-1) and the specified ProfileObject object is not found, an error message, E_PS_PROFILE_NOTEXISTS, is returned instead of a ProfileObject object.

If the bReturnError parameter is set to False (0) and the specified ProfileObject object is not found, an empty ProfileObject object is returned without an error message.

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.

The ppProfileObject parameter contains valid data only if the method completes successfully.

Example

' oProfileService is a Server ProfileService object.
' oProfileObject is a Server ProfileObject object.

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

See Also

Other Resources

ProfileService Object

IProfileService2::GetProfileByKey Method

IProfileService2::Initialize Method

ProfileObject Object

IProfileObject2::get_Fields Property