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

There is an attribute in AD called "division" which we have mapped in SharePoint 2007 and crawled in. It shows in our Profiles. I'm trying to update a custom list through a timer job that pulls the "Division" and updates the Division column in the list for each Employee, but the column remains empty. I'm pulling "Manager" and "Department" successfully so I know my code works. Could someone shed some light?

'Get UserProfileData
Public Sub GetUserProfileData(ByVal oWeb As SPWeb, ByVal SPUserAccount As String)
    Dim oSite As SPSite = oWeb.Site

    Try
        Using oSite
            'ServerContext object current site
            Dim context As ServerContext = ServerContext.GetContext(oSite)

            'UserProfileManager object to access MOSS user profiles
            Dim profileManager As New UserProfileManager(context)

            'Find the user profile of given account name
            Dim user As UserProfile = profileManager.GetUserProfile(SPUserAccount)

            'Fetching the Manager of the Current user
            If user("Manager").Value IsNot Nothing Then
                sManager = user("Manager").Value.ToString()
                'Dim UserName As [String] = user(UserName).Value.ToString()
            End If
            If user("Department").Value IsNot Nothing Then
                sDepartment = user("Department").Value.ToString()
            End If
            If user("Division").Value IsNot Nothing Then
                sDivision = user("Division").Value.ToString()
            End If

        End Using
    Catch ex As Exception
        'Write to the SharePoint ULS Log
        Microsoft.Office.Server.Diagnostics.PortalLog.LogString("An Exception Occurred on WEC.SPS.TimerJob.SR379: {0} || {1}", ex.Message, ex.StackTrace)
    End Try
End Sub

Bismarck

share|improve this question
    
What kind of error are you seeing? What is the field type? –  Mike Oryszak Nov 11 '11 at 21:47
add comment

1 Answer 1

Division is not one of the default values that Microsoft has...

http://technet.microsoft.com/en-US/library/hh147513.aspx

Manager and Department work because the User PRofile property and the Display name of the property are the same.

You'll need to crack open your User Profile settings in CA and see what your custom built field that uses "Division" as the Display name has set for it's user profile property.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.