Code to Retrieve a Profile

This section shows how to retrieve a profile.

  1. If not already connected, create a ProfileService object, oProfileService, and establish a connection to the Profile Store. For information about connecting to the Profile Store, see Code to Connect to the Profile Store.
  2. The profile object can be retrieved by specifying the schema name of the ProfileObject object, and either the primary key value or a key name/value pair. The UserObject schema type has a primary key of logon_name and a join key of user_id, which is a globally unique identifier (GUID). For information about the valid profile schema types, see Profile Schema. Retrieve the oUser1 profile created in Code to Create a New Profile.
    • Retrieve by specifying the primary key value and the schema name.

      Dim oUser1
      Set oUser1 = oProfileService.GetProfile("JoeUser@microsoft.com", _
       "UserObject")
      
    • Retrieve by specifying a key name/value pair and the schema name.

      Set oUser1 = oProfileService.GetProfileByKey("user_id", _
       "{74A38551-FFFF-FFFF-FFFF-0A20C90DC8D1}", "UserObject")
      

Copyright © 2005 Microsoft Corporation.
All rights reserved.