Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The website I'm building has a heavily extended user model. The requirement is to have a single page where admins (who are windows authenticated users) can see the profiles of all the users. Regular users (who are FBA authenticated) must also be able to view/edit their own profile from the "My Sites" profile.

The solution I've come up with involves using the User Profile service, and programatically retrieving the profiles to present to the admins. The profiles can then be edited with code similar to the following:

SPSite site = new SPSite(SPContext.Current.Site.ID);
SPServiceContext serviceCtx = SPServiceContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(serviceCtx);
UserProfile profile = profileManager.GetUserProfile(userId);
//
//Update the profile
profile["someProperty"].Value = "new value";
profile.Commit();

However, it takes about 20 seconds for the change to be seen in the admin's view. Repeating the call and inspecting the profile shows the old values. The value is immediately persisted to the DB and a user viewing their profile sees the change instantly.

It seems the data is being cached and I suspect this is the role of the User Profile Service Application Proxy but this behaviour seems wrong?

Is there a better way, or at least a way to bypass/invalidate the cache? Your help is MUCH appreciated.

share|improve this question
2  
I've seen this two and looked at the calls through reflection. Their is definitely intentional cacheing and I don't see a way around it. The cache appears to clear when a timer job is run every minute. –  Tom Resing Aug 30 '11 at 20:43
add comment

3 Answers 3

When you say "...repeating the call and inspecting the profile..." do you mean that you are inspecting the profile programmatically after the update, or from the admin's view on the web browser. I wonder if the web browser is caching the administrator's view.

share|improve this answer
    
Inspecting the profile programmatically through the debugger, so it's not the browser cache. –  Anonymous Aug 20 '10 at 17:26
add comment

We had a problem with the user profile caching too. We tried setting up a timer job to hit the service at 4.00 am so that it finishes caching by 9.00 am. For some reason it did not work always. We ended up copying the content to a DB and displaying in the site and refreshing the DB early every morning.

share|improve this answer
add comment

I believe Admin view is by browser, Verify changes are reflected in /_catalogs/users/detail.aspx, if its not updated then try updating "User Information List" directly e.g. web.Lists["User Information List"]

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.