Skip to content

List Formatting: Is embed action supported for file previews in document libraries? #10297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 of 9 tasks
tecchan1107 opened this issue Jun 10, 2025 · 5 comments
Open
2 of 9 tasks
Assignees
Labels
area:list-formatting Category: View, row & column formatting with JSON sharepoint-developer-support sharepoint-developer-support

Comments

@tecchan1107
Copy link
Contributor

What type of issue is this?

Question

What SharePoint development model, framework, SDK or API is this about?

Declarative list formatting

Target SharePoint environment

SharePoint Online

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

No response

Issue description

This is a question related to #10296 .

By applying the following embed action code to a document library, it is possible to preview files on a card. Is this method supported?

Column Formatting Sample Code
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "div",
      "style": {
        "border-radius": "50%",
        "cursor": "pointer",
        "font-size": "15px",
        "width": "27px",
        "height": "27px",
        "display": "flex",
        "justify-content": "center",
        "align-items": "center",
        "font-weight": "bold"
      },
      "attributes": {
        "class": "ms-bgColor-themeLighter ms-bgColor-themePrimary--hover ms-fontColor-neutralPrimary ms-fontColor-white--hover",
        "iconName": "View"
      },
      "customRowAction": {
        "action": "embed",
        "actionInput": {
          "src": "=if([$File_x0020_Type] == '' || [$File_x0020_Type] == 'aspx' || [$File_x0020_Type] == 'pdf', [$FileRef] , if([$File_x0020_Type] == 'docx' || [$File_x0020_Type] == 'dotx' || [$File_x0020_Type] == 'dotm' || [$File_x0020_Type] == 'docm' || [$File_x0020_Type] == 'docb' || [$File_x0020_Type] == 'pptx' || [$File_x0020_Type] == 'pptm' || [$File_x0020_Type] == 'potx' || [$File_x0020_Type] == 'potm' || [$File_x0020_Type] == 'ppam' || [$File_x0020_Type] == 'ppsx' || [$File_x0020_Type] == 'ppsm' || [$File_x0020_Type] == 'sldx' || [$File_x0020_Type] == 'sldm' || [$File_x0020_Type] == 'vsdx' || [$File_x0020_Type] == 'xlsx' || [$File_x0020_Type] == 'xlsm' || [$File_x0020_Type] == 'xltx' || [$File_x0020_Type] == 'xltm', @currentWeb +'/_layouts/15/WopiFrame.aspx?sourcedoc=' + [$FileRef] + '&action=view' , @currentWeb +'/_layouts/15/embed.aspx?UniqueId=' + [$UniqueId] + '&client_id=FileViewerWebPart&showNewWindow=true&embed={\"af\":false,\"p\":1,\"z\":\"width\"}&auth=readwrite'))",
          "height": "500",
          "width": "500"
        }
      }
    }
  ]
}

Image

The reason for asking this question is that when I created a similar code in the past, it was restricted.
#8004

@tecchan1107 tecchan1107 changed the title List Formatting: Is embed action supported for file previews in Document Libraries? List Formatting: Is embed action supported for file previews in document libraries? Jun 10, 2025
@tecchan1107
Copy link
Contributor Author

When I did this test, I changed the HTML Field Security settings.

Image

@Ashlesha-MSFT
Copy link

Hello @tecchan1107,
Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.

@Ashlesha-MSFT Ashlesha-MSFT self-assigned this Jun 11, 2025
@Ashlesha-MSFT Ashlesha-MSFT added sharepoint-developer-support sharepoint-developer-support area:list-formatting Category: View, row & column formatting with JSON labels Jun 11, 2025
@Ashlesha-MSFT
Copy link

@tecchan1107,
Just to add to this — the issue previously encountered with Embed.aspx (as noted in #9925), particularly affecting file previews, appears to have been resolved.

This could be the reason why file previews are now working correctly when using the embed action in list formatting to display them on cards.

Image

@tecchan1107
Copy link
Contributor Author

@Ashlesha-MSFT
Thanks for testing it! Am I correct in understanding that using the embed action to preview files is not a problem?

@tecchan1107
Copy link
Contributor Author

@Ashlesha-MSFT
I forgot to mention something. Regarding issue #8004, the reason the file preview is no longer available is not a bug, but a restriction, as reported in MC397486 in the Microsoft 365 Admin Center.
August 2022 - Microsoft 365 US Public Sector Roadmap Newsletter

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:list-formatting Category: View, row & column formatting with JSON sharepoint-developer-support sharepoint-developer-support
Projects
None yet
Development

No branches or pull requests

2 participants