ProfileContext.CreateProfile (String, String, String, ProfileXmlFormat) Method (BCL)

Use this method to create a new profile object instance with the specified primary key value (as a string), profile definition, XML string describing the initial state of the profile object, and the XML format type.

[Visual Basic .NET]

Public Function CreateProfile( _ByValkeyValue As System.String, _
  ByValprofileType As System.String, _
  ByValxmlData As System.String, _
  ByValxmlFormat As ProfileXmlFormat_
) As Profile

[C#]

public Profile CreateProfile(System.StringkeyValue,
  System.StringprofileType,
  System.StringxmlData,
  ProfileXmlFormatxmlFormat);

Parameters

[Visual Basic .NET]

  • keyValue
    The string value of the primary key property.
  • profileType
    The string profile definition of interest, for example, "UserObject", or "Organization".
  • xmlData
    The XML string specifying the initial state of the profile object.
  • xmlFormat
    The ProfileXmlFormat as specified in attribute-centric or element-centric format. For more information, see ProfileXmlFormat.

[C#]

  • keyValue
    The string value of the primary key property.
  • profileType
    The string profile definition of interest, for example, "UserObject", or "Organization".
  • xmlData
    The XML string specifying initial state of the profile object.
  • xmlFormat
    The ProfileXmlFormat as specified in attribute-centric or element-centric format. For more information, see ProfileXmlFormat.

Return Value

A handle to a newly created profile object.

Remarks

This method throws a CommerceProfileAlreadyExistsException exception if a profile instance with the specified primary key already exists. Note that this method only checks the local profile cache for existence of a profile with the provided key. The physical profile store is not checked until the Update method is called to commit the new profile instance to the store. For any other failure, it throws a CommerceProfileSystemException exception that wraps an inner COMException exception that contains an error code and description describing in more detail the nature of the failure.

Requirements

Namespace: Microsoft.CommerceServer.Runtime.Profiles

Platforms: Windows 2000, Windows Server 2003

Assembly: Microsoft.CommerceServer.Runtime.dll

See Also

Code to Build a Login Page

Code to Create and Set Profile Properties

Code to Retrieve and Display Profile Properties

Code to Use the SiteTerm Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.