Hybrid Sites all set up. People get redirected to OneDrive in the Cloud. They change their picture there and they see it in Delve as well. So far so good. But do you think that’s the end of the story? When I’m asking this way… then maybe not 😉
Users were kindly asked to upload a profile picture to SharePoint on-premises in the past. Now we should ask them to upload the same picture again, but this time to Delve in the cloud. My customer thought this could kill user adoption – I think so too.
The scripts I’m talking about in this blog post are on GitHub. Feel free to download or fork them.
Migrate the User Profile Pictures
SharePoint Online is still pretty similar to SharePoint on-premises under the hood. When users don’t have an Exchange Online Mailbox, the profile pictures are uploaded through Delve. The picture still gets saved on the “MySite Host” in the “Profile Photos”-Library. The library is found under the following URL: https://[tenantname]-my.sharepoint.com/User%20Photos.
When uploading the pictures through Delve, SharePoint Online still creates three thumbnails: SThumb, MThumb and LThumb.
The User Profile Serve from SharePoint Online still saves the relevant info for the user profile picture. The relevant attributes are the following:
|PictureUrl||URL to the MThumb picture.|
|SPS-PicturePlaceholderState||0 when a picture is set|
1 when the placeholder image is used
At this point, we have the thumbnails from SharePoint on-premises and we know what User Profile Service attributes in SharePoint Online we need to update.
Downloading on-premises images
Either use WebDAV to download all files from [on-premises-mySiteHostUrl]/User%20Photos or use the script here.
Rename files to correct file format
I recommend to upload a user profile picture to SharePoint Online through Delve and then check the picture file name in the Profile Pictures library (
https://[tenant]-my.sharepoint.com:443/User%20Photos/). If the naming schema of the user profile pictures in SharePoint Online differs to the one you had on-premises, you can use my script here. The script replaces the logon name in the picture name with the UPN by asking the on-premises AD.
Uploading User Profile Pictures
The script is explained extensively the synopsis of the script found here.
The script does the following:
- Iterates over all UPNs in the CSV file and does for each UPN the following.
- Gets the user profile.
- Checks if placeholder image is set by looking at
- If SPS-PicturePlaceholderState = 1, uploads the thumbnails from a folder.
- Updates UPS properties “Picture URL” to the URL of the Mthumb.jpg and “SPS-PicturePlaceholderState” to 0.
This method is surely not supported by Microsoft. But I couldn’t find another way to do this and the method described here works. It even works if you don’t have the thumbnails handy. Just upload whatever image suits you and then set the URL in the user profile to the uploaded image. I think this will definitely introduce new issues… not only because the image resolution is different from the one O365 service expect.
OK, that’s it. If you have any questions, ask in the comments.