Options for SharePoint User Profile Properties and Photos

    As I’ve mentioned, most of these blogs are for my own benefit. My memory isn’t as good as it once was… has something to do with years gone by and only limited space. Smile  It is what it is..

    My customer is working through a migration from Wave 14 (Exchange 2010, Lync 2010, and SharePoint 2010) to Wave 15 (Exchange 2013, Lync 2013, and SharePoint 2013) and the topic of user photos came up. There are a variety of ways to handle this from a technical, philosophical, and legal perspective, but being who I am we’ll stick to technical for now.

    I set up a variety of procedures in my lab and jotted down some notes about the results. Keeping in mind that my focus currently is SharePoint, I’m not discussing Lync 2013 and the only reason I’m discussing Exchange 2013 at all is due to the new integration point that allows the use of high resolution photos. The gist of what I found is below and keep in mind that some of these scenarios are highly unlikely.

    • SP2013 with no connection to User Profile Service App (UPSA)
      • Photo is stored anywhere and the user has a property called “Picture” that stores a URL to the photo in the user’s ListItem for the User Information List (_catalog/users) in the content database

    image

      • User has a menu to “My Settings” which redirects to _layouts/15/Userdisp.aspx which allows editing of the user profile properties

    image

    • SP2013 with connection to UPSA, but no MySite/Personal Site and no Active Directory Synchronization (highly unlikely)
             

      • Profiles can be manually created in UPSA (or through custom code) and synchronized into the User Information list of each content database via timer jobs
      • Profile properties are editable only through the UPSA (or through custom code)
      • Photos cannot be stored in any ‘out of the box’ method as there is no OOB option for uploading the photos. When attempting to upload a photo through the UPSA, it will error as there is no MySite host Url defined

    • SP2013 with UPSA with AD Sync, but without personal site and MySite
      • This scenario is again unlikely since without the MySite experience there is nowhere to store the photo without a custom coded solution.
      • This scenario does, however, provide us with the ability to synchronize user profile information from AD. Normally low-res photos are stored within the thumbnailPhoto, but again SharePoint has nowhere to store the photo out of the box.   

    • SP2013 with UPSA with personal site and MySite, but no AD Sync

    image

      • After you are on the “About Me” page, clicking “Edit Profile” redirects the user to EditProfile.aspx where properties can be edited and then synchronized from the User Profile database to the content databases and by the SweepSync timer job mentioned above
      • The photo in this scenario is actually stored in the MySite host under a new picture library called “User Photos”

        

    • SP2013 with full UPSA and sync with AD
      • This blog (one of many that are out there) has steps on implementing this:

    http://sharepointadam.com/2010/11/18/import-user-profile-photos-from-active-directory-into-sharepoint-2010/

      • Basically you are configuring a mapping of the SharePoint property Picture to the Active Directory attribute thumbnailPhoto. This can be configured either as ‘import’ – synchronize from AD to SharePoint – or as ‘export’ – synchronize from SharePoint to AD. After running a profile sync, then you run a powershell cmdlet (Update-SPProfilePhotoStore) to pull the photos and create a photo store within the MySite host (http://<my site url>/user%20photos). 

    • SP2013 photo sync with new Exchange High-Res Photo option
      • *requirement – App Management Service App Proxy in order to create the App Principal that is needed to interact with EWS
      • Photo stored in Exchange mailbox and requested from SharePoint when needed
      • It is also stored as a caching mechanism within the “User Photos” library of the MySite site collection
      • When adding the photo to Exchange (Set-UserPhoto powershell cmdlet) it is stored within the mailbox in multiple image sizes (see chart below) and the lowest resolution is also stored in the AD thumbnail attribute 

      Photo Size

      Width (Pixels)

      Height (Pixels)

      Parameter Value

      Thumbnail (also available in AD)

      48

      48

      HR48x48

      Small

      64

      64

      HR64x64

      Default

      96

      96

      HR96x96

      Large1

      120

      120

      HR120x120

      Large2

      240

      240

      HR240x240

      X-Large1

      360

      360

      HR360x360

      X-Large2

      432

      432

      HR432x432

      XX-Large1

      504

      504

      HR504x504

      XX-Large2

      648

      648

      HR648x648

      You can retrieve each of the above photo sizes through EWS with the following URL:
      https://<EWS Server>/ews/exchange.asmx/s/GetUserPhoto?email=<user email address>&size=<chart value>
      For example:
      will retrieve the 96×96 pixel image for ‘scottg@contoso.lab’
      Advertisements

      Export-SPWeb Syntax Changes Between Root Site and Sub Sites

      Working on a somewhat related issue today and needed to test something with Export-SPWeb. We were trying to import a list from an STP (List template) and in order to get there I decided to export one of my own lists and play around a bit. Much to my surprise I was unable to export a custom list from my lab environment. I kept getting the following error:

      export-spweb : The URL provided is invalid. Only valid URLs that are site collections or sites are allowed to be exported using stsadm.exe.
      At line:1 char:1
      + export-spweb $web -Path exported_list.cmp -ItemUrl “/lists/testlist” -Force +
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : InvalidData: (Microsoft.Share…CmdletExportWeb: SPCmdletExportWeb) [Export-SPWeb], SPException
      + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletExportWeb

      It was quite maddening as the parameters are not that difficult to figure out. (get-help export-spweb)

      So I was trying many things and discovered that in a second lab environment I had that it worked flawlessly and I was determined to discover why. The first thing that a peer of mine found for me was that in the failing environment the web from which I was trying to export the custom list was on a site collection under the ‘sites’ managed path (in other words not the root site). The environment that was working was the root site collection.

      To cut to the chase, you may not be able to use the same syntax depending on where the list resides. The parameter in question that kept failing for me was the ItemUrl parameter. It is to represent the url to the list that you would like to export. Basically if the site collection is the root site collection, then the ItemUrl should contain a leading “/” such as this:

      Export-SPWeb http://intranet.contoso.lab –Path exported_list.cmp –ItemUrl “/Lists/TestList”

      However if the site collection is not the root, then you should either include the full server relative url to the list or the web relative url to the list *without* the leading slash:

      Export-SPWeb http://intranet.contoso.lab/sites/TestImport –Path exported_list.cmp –ItemUrl “/sites/TestImport/Lists/TestList”

      or

      Export-SPWeb http://intranet.contoso.lab/sites/TestImport –Pat exported_list.cmp –ItemUrl “Lists/TestList”

      If you care to know, basically under the covers the Export-SPWeb cmdlet will call SPWeb.GetList(), but prior to calling that function it will prepend the SPWeb.ServerRelativeUrl and an extra “/” if the string in ItemUrl does not have a leading “/”. In short, to be safe if you always set the ItemUrl parameter to the server relative url and then path to the list, it should always work regardless of web location.