Friday, April 6, 2012

Resize SharePoint User Profile Pictures

If you don't host your Employee Directory Photos in Active Directory (which I've found to be pretty common), and you're using SharePoint 2010 User Profiles, you've probably done something in Forefront Synchronization Service Manager to import the Photos.  Possibly something custom or really cool that I've never even heard of.  Regardless of how you get the pictures into SharePoint, you may have a new problem:  Picture Sizing Issues.

Here's some simple Powershell to Resize those User Profile Pictures that you can run from the SharePoint 2010 Management Shell. 

Update-SPProfilePhotoStore –MySiteHostLocation “http://YourMySiteHost/”

If you want to run it from regular old Powershell it becomes a *massive 2 line script. 

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

Update-SPProfilePhotoStore –MySiteHostLocation “http://YourMySiteHost/”

What's Next?

How do we take advantage of this amazing automation you ask?  Well, for simplicity, you could save the regular option or *massive option as a "resizeUPSPhotos.ps1" and run the "resizeUPSPhotos.ps1" in Task Scheduler (or whatever you use as a Job Execution Server). 

*Note: Not actually "massive" since it's only 2 lines.

You should take into consideration the Task scheduling so that it executes after the User Profile Syncronization completes.  This could vary depending on the size of your organization and time it takes to complete the syncronization.  Much like the first Full Syncronization takes to import, the first time your resize the photos, it will also be slow.   

A Farm Administrator will be needed to run the job.  It's possible that there might be a less permission role that could be used to resize the photos, but I haven't gone that deep into investigating it.

How do I import from another source?

If you're looking to Import Employee Pictures, from a source other than the Active Directory Thumbnail Attribute, here's a great article to do so, by Chaitu Madala -

No comments: