Share via


IProfileObject2::GetProfileXML Method

Use this method to retrieve the XML schema and data of the profile object.

HRESULT IProfileObject2::GetProfileXML
(
  XMLRetrieveEnum eRetrieveEnum,
  VARIANT_BOOL bAttributeCentric,
  BSTR* pbstrXML
);
Function GetProfileXML
(
    eRetrieveEnum As XMLRetrieveEnum,
    bAttributeCentric As Boolean
) As String

Parameters

  • eRetrieveEnum
    [C++]

    [in] An XMLRetrieveEnum that indicates whether to retrieve the XML schema, data, or both.

    [Visual Basic]

    An XMLRetrieveEnum that indicates whether to retrieve the XML schema, data, or both.

  • bAttributeCentric
    [C++]

    [in] A VARIANT_BOOL that indicates the XML output format. Set this parameter to True (1) to retrieve the XML in an attribute-centric format, and to False (0) to retrieve the XML in an element-centric format.

    [Visual Basic]

    A Boolean that indicates if the XML output format. Set this parameter to True (1) to retrieve the XML in an attribute-centric format, and to False (0) to retrieve the XML in an element-centric format.

  • pbstrXML
    [C++]

    [out, retval] A pointer to a BSTR that contains the resulting XML fragment.

Return Value

[C++]

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

[Visual Basic]

This method returns a String containing the XML representation of the profile object.

Error Values

The Errors property of the ProfileService object stores the collection of errors encountered in the last Profiles resource operation. For more information, see IProfileService::get_Errors.

Remarks

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

The following table defines the possible values for XMLRetrieveEnum.

Name

Value

Description

psRetrieveInvalidValue

0

Invalid option

psRetrieveSchemaAndData

1

Both the schema and data are retrieved.

psRetrieveDataOnly

2

Only the data is retrieved.

psRetrieveSchemaOnly

3

Only the schema is retrieved.

Example

 ' sXMLProfile is a String. oProfileObject is a UserObject profile.

sXMLProfile = oProfileObject.GetProfileXML(psRetrieveDataOnly, True)

' The attribute-centric sXMLProfile string now contains:
'   <?xml version="1.0"?>
'   <ProfileDocument>
'   <UserObject>
'      <AccountInfo  org_id="{590858E1-08A7-11D3-B8C4-00104B95AE0E}" 
'         account_status="1" date_registered="2000- 6- 5T 0: 0: 0">
'      </AccountInfo>
'      <GeneralInfo  user_id="{590858DB-08A7-11D3-B8C4-00104B95FFFF}" 
'         logon_name="jilluser@microsoft.com" 
'         user_security_password="password" user_title="" last_name="User" 
'         first_name="Jill" user_id_changed_by="MyAdminID">
'      </GeneralInfo>
'   </UserObject>
'   </ProfileDocument>

sXMLProfile = oProfileObject.GetProfileXML(psRetrieveDataOnly, False)

' The element-centric sXMLProfile string now contains:
'   <?xml version="1.0"?>
'   <ProfileDocument>
'   <UserObject>
'      <AccountInfo>
'         <org_id>{590858E1-08A7-11D3-B8C4-00104B95AE0E}</org_id>
'         <account_status>1</account_status>
'         <date_registered>2000- 6- 5T 0: 0: 0</date_registered>
'      </AccountInfo>
'      <GeneralInfo
'         <user_id>{590858DB-08A7-11D3-B8C4-00104B95FFFF}</user_id>
'         <logon_name>jilluser@microsoft.com</logon_name>
'         <user_security_password>password</user_security_password>
'         <user_title></user_title>
'         <last_name>User</last_name>
'         <first_name>Jill</first_name>
'         <user_id_changed_by>MyAdminID</user_id_changed_by>
'      </GeneralInfo>
'   </UserObject>
'   </ProfileDocument>

See Also

Other Resources

ProfileObject Object

IProfileObject2::get_Fields Property