Access classification custom field in user profile - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Access classification custom field in user profile

  • Access classification custom field in user profile
  • Hi,

    I created a hierarchical classification and I added this as a custom field in the basic user profile. The problem is that now, I would like to get the value of selected items in this hierarchical classification on the user profile of current user.

    UserProfileManager profileManager = UserProfileManager.GetManager();
    UserManager userManager = UserManager.GetManager();
     var userId = ClaimsManager.GetCurrentIdentity().UserId;
     User user = userManager.GetUser(userId);

    if (user != null)

                    SitefinityProfile profile = profileManager.GetUserProfile<SitefinityProfile>(user);            
                    var extranetObj = profile.GetValue("extranet");

                    profile.SetValue("Extranet", extranetObj);         
                    profileManager.SaveChanges();
               
    But how to access to selected values in extranetObj (my hierarchical classification) and how to set selected value in it?

    Thanks for your help