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 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.

CustomIntranet.master:

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

CustomQuickLaunch.cs:

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

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

Department.cs:

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

CustomProfileHelper.cs:

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;
share|improve this question
    
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? –  Charles Lee Mar 12 '10 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 '10 at 17:50
add comment

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.

UPDATE

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/

share|improve this answer
    
I have updated my answer. –  Charles Lee Mar 15 '10 at 9:30
add comment

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.

share|improve this answer
    
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 '10 at 17:52
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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