User profile pictures is one of the key factor for collaboration with in Office365. User Pictures are surfaced on almost of the service with in Office 365 such as Exchange Online, SharePoint Online, Lync (Skype) Online as well their client applications such as Outlook, Office, Skype for business etc.
To provide seamless experience to the end users its important to understand how it pictures are synchronized internally with in Office 365, Some notable issues and possible ways of automation.
Typical User Profile Sync process:
Most common scenario is of user profile picture sync process is through DirSync. When Dirsync completes the Synchronization to Azure AD, EXO gets a copy from AzureAD then SPO gets a copy from EXO. Though Outlook/Lync online is updated instantly, SPO might take up to 72 hours to show the picture. EXO uses single image throughout the application. But SPO online uses three different images of single single user profile. For an example SPO ribbon uses a small image where as MySite/Delve uses a larger image. So the User profile Service takes extra time to scale the images.
SPO Image variations:
200px * 200 px
_layouts/15/userphoto.aspx?size=L&username=firstname.lastname@spbreed.com
72px * 72px
_layouts/15/userphoto.aspx?size=M&username=firstname.lastname@spbreed.com
48px * 48px
_layouts/15/userphoto.aspx?size=S&username=firstname.lastname@spbreed.com
Issues:
Its not always a smooth ride from DirSync to SPO. If the process fails at any of the three stages, user’s may not get a profile pic in SPO. Here are some of the scenarios
- AD images greater than 10KB or with wrong dimensions
- Licensed for SPO but not EXO
- Poor picture resolution in SPO Delve/Mysites
Resolution:
I often faced scenarios where the customers would require their pics across all the services in Office 365 in the next day. In those cases PowerShell is your friend. Below script uses Set-UserPhoto to upload high resolution pictures to EXO and ProfilePictureUploader project from Office365 Developer Patterns and Practices (PNP) to upload the Profile pictures to SharePoint Online.
Features:
Now the only thing you needed is the high resolution images on your local file share in “Firstname Lastname.JPG” format and configure the variables. This script
- Saves the credentials securely for future use
- Generates the UPN values from the User profile picture names. (Eg: John Doe.jpg => jdoe@domain.com)
- Uploads the image to Exchange online
- Scales the source image small (48px), medium (72px), Large (200 PX) images and uploads to SharePoint online
- Archive the processed images
How to run this:
Download the Zip file and Configure the below values in configuration.xml
Configuration values:
For details please refer ProfilePictureUploader project
- tenantName: eg: spbreed.onmicrosoft.com
- pictureSourceCsv: C:\Scripts\UpdateProfilePics\Release\userlist.csv
- thumbs upload3Thumbs: True
- additionalProfileProperties:
- logFile path:“C:\Scripts\UpdateProfilePics\Release\log.txt”
- uploadDelay:500
- credFile:Location to store the O365 credentials
- psLogfile: Location to store PS logs
- O365AdminAccount:o365admin@spbreed.com (Global admin)
- localPhotosFolder:\\fs.corp.local\Public\Employee Photos\O365\ready
- localPhotosArchiveFolder:\\fs.corp.local\Public\Employee Photos\O365\archive
- domainName:spbreed
- exeLocation:C:\Scripts\UpdateProfilePics\Release (Location of ProfilePictureUploader Binaries)
Troubleshooting tips:
- O365AdminAccount should be a Office 365 global administrator
- Set–ExecutionPolicy RemoteSigned should be enabled
- Powershell modules for Azure AD and MSOL Sign in assistant should be installed.
What is “userlist.csv” for? The users come from AD and the pictures need to be named, so what is the purpose of this CSV?
What if you want to only get user profile pictures from AD via AD Connect/DirSync? Do the photos in AD have to be within a certain resolution and file size in kb?
Hi, do you have latest release of this program that has multi language support?
hi! our UPNs are first name and initial (they differ from our email addresses), ie: StuartC@domain.com
where what and how do i change the variable in the script? Any help would be HUGELY appreciated
hi! Our UPNS are first name and last initial and diifere from our email addresses, ie: StuartC@domain.com
how, where and what variable do I need to change for this?
Any help would be HUGELY appreciated.
Replace GetEmail function with below code
function GetEmail
{
param([string]$name)
$temp = ($name.Substring(0, $name.IndexOf(‘.’))).split(‘ ‘)
$emailDomain = “@” + $domainName + “.com”
$email = $temp[0]+$temp[1].Substring(0,1)+ $emailDomain
LogWrite (“**– Generated $email from $name –*”)
return $email
}
hi, would i still name the .jpg “Stuartc.jpg” for example?
first name.jpg
thank you, but getting the following error 😦
Script tmp_0dcewjet.xlb {Add-AvailabilityAddressSpace, Add-DistributionGroupMember, Add-MailboxFolderPermis…
15/07/2016 12:37:47 **– Uploading Profile Picture started for StuartC.JPG.Name –*
15/07/2016 12:37:47 You cannot call a method on a null-valued expression.
15/07/2016 12:37:47
15/07/2016 12:37:47 InvalidOperation: (:) [ForEach-Object], RuntimeException
is there just a way to do it to UPN
so our UPNs are: StuartC@domain.com
our email addresses are: S.Cooney@domain.com
How do you do this if you are not using exchange online?
Is it Posible to use this tool for a German Office 365 Tenant? In that case the folder for the Profile Pictures is “Profilbilder” instead of ” Profile Pictures”
Hi , I used this code to upload few of my user pictures to Sharepoint Online. After running the script I can see the images of the users in their respective Delve Site. How ever for some of the users in the log I am seeing the below error message. You have any idea what might be the issue.
User Error: Failed to upload thumbnail picture to SPO for ###.com Cannot access a closed Stream.
Pingback: I’m not “Doughboy”, I’m a real person (and it’s not Yammer’s fault) | buildbod.com
Hi ! I’m trying your solution but I have an error with the connection to profile web service “Error initiating connection to profile web service in SPO Value cannot be null. Parameter name: cookieHeader” Can you help me ?
Sorry I find my error. But now I have a new one. When it try to upload the pictures, I have this error :
==> Uploading threes image to SPO, with resizing
==> Uploading small image to /User Photos/Profile Pictures/YBenhammada_SThumb.jpg
==> User Error: Failed to upload thumbnail picture to SPO for YBenhammada The remote
server returned an error: (409) Conflict.
Can you help ?
Thanks in advance
Finally I have the same error than Vishnu. Do you have an idea ?