Active Directory: Please can we have a added functionality to pick up Job Titles/Role Names

Occasional Contributor

Reason for request: To save time entering job titles and reduce human error.  To enhance the use of MS Project to wider team/Company.

We would like a single source of truth - Active Directory to fetch the required key data


Thank you!



1 Reply

Hello @wah ,

There is nothing out of the box to do this, it will require a custom solution. You could quite easily do this with a scheduled PowerShell script for example, here is a blog post I wrote a few years ago now: 

The code is not available on the download link anymore but I have copied it below. Please note, I haven't tried this code for 5+ years so it might / will need updating but should help get you started. Please update and fully test on a non-production instance first so that you are happy with it. The script is provided “As is” with no warranties etc.

#Add in libraries - update for the correct location
#SharePoint Online CSOM DLL
Import-Module 'C:\Users\paulmather\OneDrive for Business\External Disk\SharePointOnlineCSOMDLLs\16.1.5521.1200\Microsoft.SharePoint.Client.dll'
#Project Online CSOM DLL
Import-Module 'C:\Users\paulmather\OneDrive for Business\External Disk\SharePointOnlineCSOMDLLs\16.1.5521.1200\Microsoft.ProjectServer.Client.dll'

#install the Azure AD PowerShell module - downloaded from here
#Set Azure AD user details - update for correct username, password and CSV file location
$ADusername = "userName"
$ADpassword = "password"
$CSVfilelocation = "C:\Temp\ADusersFULLAD.csv" 
$secureADpassword = ConvertTo-SecureString $ADpassword -AsPlainText -Force
$ADcreditials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ADusername,$secureADpassword
Import-Module MSOnline
connect-msolservice -credential $ADcreditials
Get-MsolUser -All | Select DisplayName, UserPrincipalName, Title | Export-CSV -NoTypeInformation -Path $CSVfilelocation

#Set PWA details - update for correct URL, username and password
$PWAInstanceURL = ""
$PWAUserName = "userName"
$password = "password"
$securePass = ConvertTo-SecureString $password -AsPlainText -Force 

#Custom field ID - update for correct custom field internal ID
$customFieldInternalName = "Custom_3fa3e04146a4e61180d100155d507a05"

$projContext = New-Object Microsoft.ProjectServer.Client.ProjectContext($PWAInstanceURL)
[Microsoft.SharePoint.Client.SharePointOnlineCredentials]$spocreds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($PWAUserName, $securePass); 
$projContext.Credentials = $spocreds

#load resources

#Import CSV file created previously and update associated resources
Import-Csv $CSVfilelocation | Foreach-Object { 
    try {        
        $resName = $_.DisplayName   
        $resource = $projContext.EnterpriseResources | select Id, Name | where {$_.Name -eq $resName}
        if($resource -ne $null){
            $res = $projContext.EnterpriseResources.GetByGuid($resource.Id)
            $res[$customFieldInternalName] = $_.Title
            Write-host -ForegroundColor Green "'$resName' has been updated"
        else {
            Write-host -ForegroundColor Yellow "'$resName' not found"
        write-host -ForegroundColor Red "Add error occurred whilst attempting to update resource: '$resName'. The error details are: $($_)"