1

Not a huge fan of the new fangled site layout for newly created SharePoint Online sites, but it is growing on me. One feature I particularly like is the ability to view PowerShell files, complete with color-coding, directly in the browser. Can't edit the file in the browser (yet) but just being able to view it is surprisingly helpful. Doing the same in classic mode just prompts to download the file.

Ohhh...so pretty!

Not so pretty.

Is this something I can enable in 'classic mode' using SharePoint Designer, etc?

FWIW, it's tricky to Google for an answer because all I get are articles about using PowerShell to upload files. Probably some magic search query to get the answer but my Google Fu has failed me thus far :(

  • I don't know the formatting of the URL to the new experience file viewer you are using for the .ps1 file. But, would it be possible to use CSR, override the click event of all .ps1 files and reroute them to the new URL? – S. Walker Aug 9 '17 at 23:15
0

Been digging through the firebug inspector output and it seems that all one has to do to force bringing up the file in the viewer (as opposed to prompting for download) is to put a direct link invoking AllItems.aspx with a query/param string of the relative path to the file and the parent library:

https://mytenant.sharepoint.com/mysite/mylibrary/Forms/AllItems.aspx?id=%2Fmysite%2mylibrary%2FMyPowershellScript%2Eps1&parent=%2Fmysite%2Fmylibrary

Even if the library itself is in 'Classic Mode', that format will bring up the fancy viewer. Haven't tested with other script/code file types, but I suspect it's the same with them.

Another thing I just noticed is that, regardless of the mode one is in, the link will always prompt for download when clicking the file link via a web part; it has to be done from the document library page. Interesting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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