The master page on our SharePoint 2007 sites display the current user's department and division. The users department and division are sourced from the SharePoint profile.

Recently, we have been seeing the wrong department/division displayed for users. The department could be HR one minute and then IT the next, when it should be Finance. We have verified at the time that the users' information is correct in their SharePoint profile.

We think this odd behaviour is related to a cleanup of users and user groups that we performed recently. We deleted all SharePoint groups and now the majority of users belong to a 'visitors' group with read permissions. The users are added to the vis 'authenticated users' AD group.

I am new to SharePoint and would appreciate any help with this issue.

Here's snippets of the code used. The master page calls C# code to retrieve the department from the profile and outputs the results in HTML.


<td valign="top" id="leftColumn" bgcolor="#a0d8d7"> 
<img alt="" src="/PublishingImages/bg.gif" width="174" height="1"><CustomWebControls:CustomQuickLaunch  
                ID="ctrlQuickLaunch"/><br /></td>


protected override void RenderContents(HtmlTextWriter output)
    // write out the quick lauunch department opening html

private void Write_QuickLaunchHeader(HtmlTextWriter output)
    output.Write("<div class=\"h1Surround\">");
    output.Write("<h1>{0}</h1>", Department.Get_Department());


public class Department
    public static string Get_Department()
        CustomProfileHelper profileHelper = new CustomProfileHelper(PropertyConstants.Department);
        return profileHelper.ProfilePropertyValue;


string propertyValue = string.Empty;
SPSite site = SPContext.Current.Site;
SPWeb web = SPContext.Current.Web;
SPUser userObject = (SPUser)web.CurrentUser;
ServerContext context = ServerContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(context);
string sAccount = ExtractUserName(userObject.LoginName);
UserProfile userProfile = profileManager.GetUserProfile(sAccount);
propertyValue = userProfile[m_PropertyName].Value.ToString();
return propertyValue;
  • I assume that the value of m_PropertyName maps to the name of the department item on your profiles? Is this failure random or is there a pattern to it? Mar 12, 2010 at 15:56
  • Correct m_PropertyName maps to Department in the profile. This failure happened with think when we cleaned up user groups, so I'm wondering if it's related to permissions. The only pattern we see is the HR department might be returned for a few users in teh space of a few minutes then all these users switch to IT and so on.
    – Anonymous
    Mar 12, 2010 at 17:50

3 Answers 3


How is this data being surfaced within the master page? Custom control? Web Part? JavaScript?

Without knowing what the code that does this is doing its going to be hard to pin point the issue at hand.


If you recycle the App Pool when a user is experiencing this issue and then refresh the page do they then get the correct value? This would indicate a caching issue.

You could also check the page requests in Fiddler to see if any caching is set. http://www.fiddler2.com/fiddler2/

  • I have updated my answer. Mar 15, 2010 at 9:30

Do you have page output caching enabled by any chance?

If so, this may cause user A to see the cached version of a page that was served to user B earlier.

  • The Site Output cache is set to 'Inherit the profile 'Intranet (collaboration Site)' for authenticated users. We have never changed this setting. We also noticed that users with full control are not experiencing this issue.
    – Anonymous
    Mar 12, 2010 at 17:52

Output Cache can cause this issue. Check to see if Output Cache is turned on. if it is create custom profile and use private caching also vary by header you can vary by user-agent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.