Sp-dev-docs: Column Formatting New Image Field in Modern Lists

Created on 16 Oct 2020  Â·  6Comments  Â·  Source: SharePoint/sp-dev-docs

I see that Image is in the list of supported column types for column formatting, but it isn't clear if that is the new Image column type in modern lists. If that is supported, can we get an example? I can only return "object, object" when trying to adjust the column formatting. I simply want to make the thumbnail bigger. The thumbnail formatting options for document libraries don't work and you can't seem to get a src or title from the currentfield.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

docs-comment list-formatting fixed question

All 6 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

Hi @MichaelS4G,

I think Image column type is supported, see below I add some style to the image column.

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "img", "attributes": { "src": "@currentField.serverRelativeUrl" }, "style": { "border": "2px solid red", "border-radius": "5px" } } ] }

image

The above column is Image type, not Hyperlink or Picture.

image

How to know the property name of @currentField? I just get it via rest api request.

image

Baker Kong
Microsoft SharePoint Community Support

@MichaelS4G Thanks for pointing out the gap in the documentation. I will update more details about how to use the Image column in list formatting.

Thank you! @currentField.serverRelativeUrl seems to do the trick. I had tried guessing at other variations with no luck. The API suggestion is a good idea too.

The documentation is not updated with an example. Closing this.

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karishmaTCS picture karishmaTCS  Â·  3Comments

SteIvanov picture SteIvanov  Â·  3Comments

Ralms picture Ralms  Â·  3Comments

mikeparkie picture mikeparkie  Â·  3Comments

nanddeepn picture nanddeepn  Â·  3Comments