ProfileService.CreateProfile Method (PIA)

Use this method to create a ProfileObject object.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Profiles
…
Public Function CreateProfile(sValue As Object,
  bstrType As String) As IProfileObject

[C#]

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

Parameters

[Visual Basic .NET]

  • sValue
    An Object that contains the primary key value for the new ProfileObject object. The variable types permitted for this object are String or Integer.
  • bstrType
    A String that contains the schema type for the new ProfileObject object.

[C#]

  • sValue
    An object that contains the primary key value for the new ProfileObject object. The variable types permitted for this object are string or int.
  • bstrType
    A string that contains the schema type for the new ProfileObject object.

Return Values

[Visual Basic .NET] If this method completes successfully, it returns an object that implements the IProfileObject interface. The reference is set to **Null****if a ProfileObject object of the specified primary key and schema type already exists in the Profiles store.

[C#] This method returns an object that implements the IProfileObject interface. The reference is set to null if a ProfileObject object of the specified primary key and schema type already exists in the Profiles store.

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 CreateProfile method fails on an aggregated profile (one that has multiple data sources), the DeleteProfile method must be called to clean up any entries in the data stores. In this case, the DeleteProfile method will produce an error that should be ignored.

The CreateProfile method verifies that a ProfileObject object with the specified attributes does not already exist in the database.

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

Use the GetProfile or GetProfileByKey method to retrieve existing ProfileObject instances from the Profiles store.

Call the Initialize method before you use this ProfileService method.

[Visual Basic .NET]

Example

' oProfileService is a Commerce ProfileService object
' oProfileObject1 and oProfileObject2 are Commerce ProfileObject objects

oProfileObject1 = oProfileService.CreateProfile _
 ("{73A4C9C1-D68D-11D0-98BF-00A0C90DC8DF}", "Address")

oProfileObject2 = oProfileService.CreateProfile _
 ("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.DeleteProfile

ProfileService.GetProfile

ProfileService.GetProfileByKey

ProfileService.Initialize

ProfileObject Class

ProfileObject.Fields

Copyright © 2005 Microsoft Corporation.
All rights reserved.