SOLVED

Modern SharePoint File Viewer URL

%3CLINGO-SUB%20id%3D%22lingo-sub-105321%22%20slang%3D%22en-US%22%3EModern%20SharePoint%20File%20Viewer%20URL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105321%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20open%20a%20file%20in%20the%20modern%20library%20File%20Viewers%20from%20a%20html%20link%20on%20a%20page%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOr%20will%20these%20file%20viewers%20only%20ever%20work%20from%20a%20link%20in%20a%20modern%20document%20library%3F%20they%20seems%20to%20just%20overlay%20the%20view%20in%20the%20current%20page.%20There%20must%20be%20a%20handler%20on%20the%20page%20to%20call%20the%20file%20viewer%2C%20as%20the%20url%20doesn't%20seem%20special.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20918px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F19957iB04D1DE68DDA5C52%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-105333%22%20slang%3D%22en-US%22%3ERe%3A%20Get%2C%20build%20or%20open%20SharePoint%20File%20Viewer%20URL%20for%20a%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-105333%22%20slang%3D%22en-US%22%3ELooks%20like%20I%20answered%20my%20own%20question%2C%20you%20can%20just%20build%20the%20link%20using%3CBR%20%2F%3E%3CBR%20%2F%3Ehttps%3A%2F%2Ftenant%2Fsites%2Fsitename%2Fassets%2FForms%2FAllItems.aspx%3Fid%3D%2Fsites%2Fsitename%2Fassets%2Ffilename.wmv%26amp%3Bparent%3D%2Fsites%2Fsitename%2FSiteAssets%2Fpagename.aspx%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20X%20button%20on%20screen%20will%20redirect%20to%20the%20parent%20in%20a%20new%20window%2C%20not%20the%20nice%20UX%20but%20at%20least%20it%20doesn't%20redirect%20the%20user%20back%20to%20the%20raw%20list%20view%20from%20a%20custom%20page.%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

 

Is there a way to open a file in the modern library File Viewers from a html link on a page?

 

Or will these file viewers only ever work from a link in a modern document library? they seems to just overlay the view in the current page. There must be a handler on the page to call the file viewer, as the url doesn't seem special.

 

image.png

1 Reply
Best Response confirmed by Warwick Ward (Frequent Contributor)
Solution
Looks like I answered my own question, you can just build the link using

https://tenant/sites/sitename/assets/Forms/AllItems.aspx?id=/sites/sitename/assets/filename.wmv&parent=/sites/sitename/SiteAssets/pagename.aspx

The X button on screen will redirect to the parent in a new window, not the nice UX but at least it doesn't redirect the user back to the raw list view from a custom page.