In a list I used column formatting to display a user's profile picture by building a url to the image like this:

"elmType": "img",
      "attributes": {
        "src": "='/_layouts/15/userphoto.aspx?size=L&username=' + [$iNumber] + '@xxx.com'",
        "title": "@currentField" 

Where "$iNumber" is the employee's id in a single line of text field (cannot use a people field in this case). Now I want to apply view formatting to improve the entire view, and tried this:

"elmType": "img",
                "attributes": {
                  "src": "=@currentWeb + '/_layouts/15/userphoto.aspx?size=L&username='+ [$iNumber] + '@xxx.com'"

And this using an operator for the url:

"operator": "+",
                "operands": [

The output when I inspect the element for either is:

src="/_layouts/15/userphoto.aspx?size=L&username=' + [@iNumber] + '@xxx.com'"

So the field value isn't getting pulled in. Is this a formatting error or is it because there's a conflict between the column and view formatting?

  • Try changing [@iNumber] to [$iNumber] ? Commented Apr 9, 2020 at 17:06
  • What is stored in [$iNumber] filed? User email? Commented Apr 9, 2020 at 17:11

1 Answer 1


You need to use user email address to get the profile picture. Below is the generic format to get the profile picture of user:

 "elmType": "img",
 "attributes": {
      "src": "='/_layouts/15/userphoto.aspx?size=S&accountname=' + <user email address>"

Replace <user email address> with user email address.

Sample Example:

GitHub - person-roundimage-format

Note: To refer another column in JSON formatting you need to use it in below format - [$InternalNameOfColumn]

Source: SharePoint JSON formatting - Refer another column

  • Actually I am using the email address ([email protected]) and the images work but my suspicion about column formatting overriding the view format was correct. I removed the column format and it started working - on another view though (which is stil very odd).
    – matt
    Commented Apr 9, 2020 at 18:02
  • Yes, column formatting overrides view formatting. If you have applied any column formatting in same view then you need to remove it or create a new list view and add view formatting there. Commented Apr 9, 2020 at 18:20
  • Hi @matt, does this answers your question? If Yes, Please Upvote(^) and accept as an Answer so that it will help others in future to find the correct answer easily. Commented May 15, 2020 at 9:11
  • Column Formatting does not override view formatting. It is the opposite. Column Formatting can be used in conjunction with View formats that use the rowClass attribute. But when using the rowFormatter attribute, column formats are ignored. Commented Sep 27, 2020 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.