Creating Staff Directory in SharePoint

I've created a simple but effective staff directory - User Name with Presence,  Job Title, Department, Floor, Work Email and Work Phone.  Everyone loves it, but they want the fax number listed as well.

I've set up Profiles so that the Fax number is brought over from the Active Directory.  It shows up in the User Profile, but I can't locate the field to display in a customer view.

I've attached some screenshots to clarify.  Any help in this matter would be most appreciated!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I believe you are working with the internal SharePoint User Information List for the Site Collection. Please correct me if I am wrong.

You can add a "Fax Number" column to it, but it will not automatically sync from the Profile DB. I could be wrong, but I highly doubt it.

What you can do is manually sync that particular field using Powershell.

Okay here is pretty much a complete solution. I was coding some stuff with Powershell and the UserInformationList so it wasn't too much time.

My assumption is that you are working off the User Information List.

To add the "Fax Number" Column:
   Go to Site Settings->People and Groups
   Select Settings->List Settings
   Select "Create column" and add "Fax Number"

Note that this "Fax Number" column you added will not automatically sync from your User Profile database/import.

We are going to use Powershell to sync the data. You can schedule the script via Task Manager once you have throughly tested it.

The script that will sync the "Fax Number" from AD or SPUserProfiles. Edit the two URL variables. PLEASE TEST UNDER A NON-PRODUCTION ENV. I take no responsibilities.

function get-FaxFromAD($SAMAccountName)
	$root = [ADSI]''
	$searcher = New-Object System.DirectoryServices.DirectorySearcher($root)
	$searcher.filter = "(&(objectClass=user)(objectClass=user)(sAMAccountName=$SAMAccountName))"
	$ADuser = $searcher.findall()
    $returnValue = $ADuser[0].properties.facsimiletelephonenumber
    return $returnValue

function Get-SPProfileManager([string]$PortalURL)
# Need to get a PortalContext object 
# as we do not have a HttpContext we need to source one the hard way
$site=new-object Microsoft.SharePoint.SPSite($PortalURL)
$site.Dispose() # clean up
# Return the UserProfileManager
new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($servercontext)
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null

#Change the URLs below to match your environment
$portalurl = "http://portal"
$SiteCollectionURL = "http://portal/sites/testsite"

#GET UserProfileManager
$portal    = new-object Microsoft.SharePoint.SPSite($portalurl)
$portalweb = $portal.OpenWeb()
$upm       = Get-SPProfileManager $portalurl

#GET Site Collection User Information List
$site = New-Object Microsoft.SharePoint.SPSite($SiteCollectionURL)
$web = $site.openweb()
$userInfoList = $web.SiteUserInfoList.Items

foreach ($user in $userInfoList)
   Write-Host "###########"
   $faxFromAD = get-FaxFromAD($user["Name"].split("\")[1])
   $userProfile = $upm.GetUserProfile($user["Name"])
   $faxFromUserProfile = $userProfile["Fax"]
   Write-Host "Current Fax: ", $user["Fax Number"]
   Write-Host "Fax from AD: ", $faxFromAD
   Write-Host "Fax from User Profile: ", $faxFromUserProfile

   #Uncomment below to update fax number. You should also but some error checking, at the very least for nulls.
   #$user["Fax Number"] = $faxFromAD
   #$user["Fax Number"] = $faxFromUserProfile


Open in new window

ZithrobAuthor Commented:
quihong - thanks for the code.  I don't have a non-production environment to test - it'll have to be a weekend process.

One question - I was able to create and populate the "Floor" field, using the AD "Office" attribute - any idea why the Fax field won't update by the same method?
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Can you clarify your question? Are you saying you added the "Floor" column to the User Information List and it auto synced with the "Office" field from  the UserProfile db/iimport? Can you provide some details on how you created the "Floor" field?

BTW, you can test it on a separate new site collection.
ZithrobAuthor Commented:
The Floor column was originally titled "Office", I renamed it and mapped it to "Floor" in the profile synchronization.   The fax field was already there, I just added the map to the field "facsimileTelephoneNumber".

Perhaps I have the wrong field?
With MOSS, fields from the User Information List of the Site Collection (each site collection has its own) will automatically sync with the UserProfile from the SSP.

The "Office" field and the others you are currently using for your Staff Directory syncs from the UserProfile. Fax Number is not one of those fields.

Typically most companies use the UserProfile db for their Staff/Employee Directory. Using the Site Collection User Information List would be appropriate if you only had WSS. One down side of the User Information List would be, when a employee leaves you have to manually delete the employee.

Here is some info on how MOSS and the User Profile and Site Collection User Information List work together.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.