Code to Modify a Profile

This section shows how to modify the data stored in a profile. To modify the schema of a profile (the data structure), use the Profile Definition Designer in Commerce Server Business Desk. For more information, see Adding Properties to a Profile Definition.

  1. If not already connected, create a ProfileService object, oProfileService, and establish a connection to the Profile Store. See Code to Connect to the Profile Store.

  2. Retrieve the oUser1 profile. For more information, see Code to Retrieve a Profile.

  3. Modify the first_name and tel_number of the oUser1 profile. This example uses smart navigation instead of the Fields collection to access the profile properties. For information on the available properties for the profiles shipped with Commerce Server, see Profile Schema. Note the two different syntaxes available for accessing the properties. Both are equivalent.

    oUser1.first_name = "Joseph"
    oUser1.tel_number = "(123) 456-7890"
    
    oUser1.GeneralInfo.first_name = "Joseph"
    oUser1.GeneralInfo.tel_number = "(123) 456-7890"
    
  4. Save the change to the Profile Store.

    oUser1.Update
    

Copyright © 2005 Microsoft Corporation.
All rights reserved.