Retrieve and Update Custom Profile Type given to a User

Posted by Community Admin on 04-Aug-2018 09:50

Retrieve and Update Custom Profile Type given to a User

All Replies

Posted by Community Admin on 11-May-2015 00:00

Hi all,

 I have created a new profile type for users called "Vendor" and in it I have defines a "Yes/No" field called "FeaturedUser". I have been trying out a lot of methods which I came across in many blogs and forums but it says

 "Wrong custom field 'FeaturedVendor' for type 'Telerik.Sitefinity.Security.Model.SitefinityProfile'"

Following is the code that I have used:

 

 UserProfileManager profManager = UserProfileManager.GetManager();
 var profile = profManager.GetUserProfile(ClaimsManager.GetCurrentUserId(),typeof(SitefinityProfile).FullName);
 var value = DataExtensions.GetValue(profile, "FeaturedVendor");​

 

Am I missing something or am I doing it the wrong way?

 

The version of Sitefinity is 7.0

Posted by Community Admin on 14-May-2015 00:00

Hello Aby,

You said that your custom profile is called Vendor and your field is called FeaturedUser. As far as I can see from the provided code sample you are trying to get the value of FeaturedVendor field, but not for FeaturedUser.

UserProfileManager profManager = UserProfileManager.GetManager();
 var profile = profManager.GetUserProfile(ClaimsManager.GetCurrentUserId(),typeof(SitefinityProfile).FullName);
 var value = DataExtensions.GetValue(profile, "FeaturedVendor");​

If there is no field with such name available it is pretty normal to receive this error.

Regards,
Kaloyan
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed