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
