I have a property in the user profile. This property has privacy settings equal to "Private" (or "Only Me" if working through UI). It means that value for this property will be shown only to you or admin of user profile application. I want to get value of this property in a web part under any other user through code. I use this code, but it's not working (property value equals to null due to privacy settings, but it's not null actually):
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (var site = new SPSite(SPContext.Current.Site.ID))
{
var manager = new UserProfileManager(SPServiceContext.GetContext(site));
var profile = manager.GetUserProfile(@"domain\name");
var value = profile["my_property_name"].Value;
}
});
Is it possible to get profile property with Private privacy through code?
Thanks in advance.
publicI can read value, when switch again toprivate- null returns as value. – Kai Jan 30 '12 at 14:49