bottombackground
Jun5

Reading through SharePoint User Profiles and Properties  

Categories: Moss 2007, Search
Technorati Tags: ,

A few months back I created this blog post about how to get access to the User Profiles from code on which Robin Meure from Zevenseas helped me with.

This worked perfect for my customer until yep they upgraded to SP2 of SharePoint.

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.

Thanks to Michel Goulmy of Realdata. I think this policy is overdone since you can manage it in different ways.

Hope it helps people with the same problem.

 
Bookmark this post with:                                  
 
 

Links to this post

Comments

Leave a comment





CAPTCHA Image Validation






© Copyright 2010 KbWorks B.V.    Paul Keijzers op linkedin KbWorksLinkedin Paul Keijzers op Twitter @KbWorksTwitter KbWorks op Promote your networkPromote Your network