Access classification custom field in user profile

Posted by Community Admin on 04-Aug-2018 13:52

Access classification custom field in user profile

All Replies

Posted by Community Admin on 01-Jul-2016 00:00

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

This thread is closed