IProfileService2::CreateProfileXML Method [C++]

Use this method to create a ProfileObject object using XML data.

Definition

[C++]

HRESULT IProfileService2::CreateProfileXML(VARIANTsValue,
  BSTRbstrProfileType,
  BSTRbstrProfileXML,
  XMLFormatEnumeXMLFormat,
  IProfileObject2**pIProfileObject2);

[Visual Basic]

Function CreateProfileXML(sValue As Variant,
  bstrProfileType As String,
  bstrProfileXML As String,
  eXMLFormat As XMLFormatEnum) As IProfileObject2

Parameters

  • sValue [C++]
    [in] A VARIANT that contains the primary key value for the new ProfileObject object. The variable types permitted for this variant are VT_BSTR or VT_I4.
  • sValue[Visual Basic]
    [in] A Variant that contains the primary key value for the new ProfileObject object. The variable types permitted for this variant are String or Long.
  • bstrProfileType[C++]
    [in] A BSTR that contains the profile type.
  • bstrProfileType[Visual Basic]
    A String that contains the profile type.
  • bstrProfileXML[C++]
    [in] A BSTR that contains the profile properties in XML.
  • bstrProfileXML[Visual Basic]
    A String that contains the profile properties in XML.
  • eXMLFormat[C++]
    [in] An XMLFormatEnum that contains the XML format. See the Remarks section for allowed values.
  • eXMLFormat[Visual Basic]
    An XMLFormatEnum enumeration that contains the XML format. See the Remarks section for allowed values.
  • pIProfileObject2[C++]
    [out, retval] The address of a pointer to the IProfileObject interface of the newly created ProfileObject object. The pointer is set to NULL if a ProfileObject object of the specified primary key and schema type already exists in the Profiles store.

Return Values

[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 the newly created ProfileObject object. The object is set to **Nothing****if a ProfileObject object of the specified primary key and schema type already exists in the Profiles store.

Error Values

[C++] The Errors property stores the collection of errors encountered in the last Profiles resource operation. For more information, see IProfileService::get_Errors.

[Visual Basic] The Errors property stores the collection of errors encountered in the last Profiles resource operation. 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.

Call the Update method on the returned ProfileObject object to commit the new profile to the data store. The Update method will verify 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.

The following table shows the values in the XMLFormatEnum enumeration, their associated names, and describes their use.

Name Value Description
eInvalid 0 Reserved for future use.
eAttributeCentric 1 Attribute centric XML format.
eElementCentric 2 Element centric XML format.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[C++]

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

[Visual Basic]

Example

' oProfileService is a Commerce ProfileService object
' oProfileObject1 and oProfileObject2 are Commerce ProfileObject objects
' sXMLProfile is a string contining the profile properties

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

oProfileObject2 = oProfileService.CreateProfileXML _
 ("Joeuser@microsoft.com", "UserObject", sXMLProfile, eAttributeCentric)

See Also

[C++]ProfileService Object

[C++]IProfileService::DeleteProfile

[C++]IProfileService::GetProfile

[C++]IProfileService::GetProfileByKey

[C++]IProfileService::Initialize

[C++]ProfileObject Object

[C++]IProfileObject::get_Fields

[Visual Basic]ProfileService Object

[Visual Basic]ProfileService.DeleteProfile

[Visual Basic]ProfileService.GetProfile

[Visual Basic]ProfileService.GetProfileByKey

[Visual Basic]ProfileService.Initialize

[Visual Basic]ProfileObject Object

[Visual Basic]ProfileObject.Fields

Copyright © 2005 Microsoft Corporation.
All rights reserved.