Reference : KOBWORKS
I used reflector to look up where this could be but could not easy find it. After some tweets and help from Robin he figured out that it was in the Server Context call.
using (SPSite site = new SPSite(url))
{
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context,True);
Type type = profileManager.GetType();
// Haal internal field 'm_bIsSiteAdmin' op
FieldInfo field = type.GetField("m_bIsSiteAdmin", BindingFlags.NonPublic |BindingFlags.Instance);
if (field != null)
{
// Om bug te fixen moet deze boolean altijd op true staan
field.SetValue(profileManager, true);
}
foreach (UserProfile profile in profileManager)
{
if (profile["AGBcode"].Value != null)
{
Blah
}
}
}
The default privacypolicy is false this means you can not view items that are private("only me") in the userprofile. This is the way you could solve it.
In this case we had a smarter and easier way without changing the code.
Since these property may not been seen by others. We edited the property in the userprofile.
We putted the privacy to everyone removed it from indexing and removed all checkboxes to show.
No comments:
Post a Comment