More in this section
Forums / Developing with Sitefinity / Access classification custom field in user profile

Access classification custom field in user profile

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
1 posts, 0 answered
  1. Sophie
    Sophie avatar
    5 posts
    Registered:
    09 Jun 2016
    01 Jul 2016
    Link to this post

    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

1 posts, 0 answered