SharePoint 2010, Office 2010 and Profile Pictures
As many of you will know SharePoint & Office make heavy use of your profile pictures to personalize the experience. For example, here is my profile photo in my My Site.
I get to set up this stuff up quite often in demo environments & so i thought i would post about the process for doing this.
The first thing is to get the photos into your My Site. Easiest way to do that is to manually upload it via your profile page. But you can also use some code to upload the file (use UploadSPFile powershell commandlet) to a document library and then use some more powershell to set the “PictureUrl” profile property property to point at the uploaded file.
Example Uploading Photo:
[Microsoft.SharePoint.SPFile]$file = UploadSPFile -url ([string][string]"https://intranet/my/") -libraryName "User Photos" -filePath "<path to photo to upload here>"
*** UPDATE *** Get Supporting PS File with UploadSPFile function from here.
Example Setting Profile Property:
$upm = GetProfileManager -url $siteUrl
$up = $upm.GetUserProfile("CONTOSO\danj");
$picturePropertyName = GetProfilePropertyName -UserProfileManager $upm -PropertyName "PictureUrl";
if (-not [System.String]::IsNullOrEmpty($picturePropertyName))
$PortraitUrl = CombineUrls -baseUrl $file.Web.Url -relUrl $file.ServerRelativeUrl;
$up.get_Item($picturePropertyName).Value = $PortraitUrl;
This will simply set the picture you uploaded as the profile picture.
But wait … there’s more …
You can upload a picture of any dimensions and size … however SharePoint and Office have some images sizes that work best in the UI and SharePoint provides some help to get all your pictures resized to 3 sizes it needs. 96x96 is the largest optimal profile picture size.
SharePoint provides a powershell command to automatically resize all your profile pictures for you.
Example, resizing profile pictures to optimal resolutions:
Update-SPProfilePhotoStore –MySiteHostLocation “https://intranet/my/”
This command will take a look at every users profile picture and will do two things:
- Re-Size the photo into the 3 optimal sizes and save them in SharePoint
- Set the users profile property to the newly resized photo
Now you should have great looking photos in SharePoint. Additional tip for getting great photos … make sure you start with a square image. That way you make use of the optimal viewing window for profile pics in SharePoint.
Now … that is the SharePoint part out of the way. The next part is getting photos into apps like Outlook and Communicator.
The Exchange blog has a great post on this topic and so i won’t repeat here. You can read that post here: GAL Photos in Exchange 2010 and Outlook 2010
Here is some additional reading on this topic:
- If you are upgrading you also need to update your profile photos to the new sizes. More Info here: https://technet.microsoft.com/en-us/library/cc263286(office.14).aspx#Taxonomy
The best part about setting all this up is that people will quickly realize they don’t have a photo set up in SharePoint and will not want to be left out! Sooner or later you will get nice rich looking SharePoint profiles & pictures for people in Outlook.