0

Are sandboxed solution custom actions and javascript the best way to replicate the old on-prem functionality of delegate controls?

I know sandboxed solutions with code aren't a possibility in SPO anymore, but I've seen posts out there saying sandboxed solutions are absolutely still valid in this scenario. Is this true, or are there other options?

0

Declarative sandbox solutions are indeed supported in the SharePoint Online. Code-behind are not. Best option for this would be based on the detailed use case and scenario, but I'd approach this as follows.

  1. Create needed UI widget JavaScript file
  2. Upload file to centralized location - could be CDN or for example root site collection of particular tenant
  3. Use remote APIs to add this JavaScript file to UserCustomActions in site collection level -> it's activated in all sites in site collection

For deployment perspective would use PnP PowerShell, unless this should be automated. This way you can simply write scripts, which are pushing this to all site collections without requirement to go to UIs for activating sandbox solutions.

If you would have multiple files and would have to deploy stuff to each of the site collections, would look into creating PnP Remote Template for your configuration, but if it's only for associating JS file at site collection level, you can easily achieve this for example with Add-PnPJavaScriptLink (https://msdn.microsoft.com/en-us/pnp_powershell/addpnpjavascriptlink).

Note. This model ONLY works on classic mode, not in the modern sites. For modern sites, there's currently no supported way to do similar UI widgets. Work to enable that for them is on it's way, but can provide detailed schedules on that.

Like mentioned, obviously detailed scenario does have impact on the right design as well. How often this should be done, how it's integrated to new site collection creation, is it one time change etc.

  • Thanks! I think Bert's example might be the best. A scenario would be to add a custom control next to the search box on all pages (eg, a quick links dropdown). I saw other examples of the add-in model. That feels like a hammer to attack a screw. I know there is nothing in SPFx yet and have seen notes this scenario is being planned for. I assume Bert's approach will be merged into the SPFx approach. ;-) Or at least, there will be an easy transition. Only problem I see is, the next dev isn't going to be sure how this customization was achieved unless they know about this option. – kduenke Mar 9 '17 at 16:37
  • There won't be native conversion from classic JS customizations to SPFx, so that will require future work in the modern sites. Regardless how customizations are achieved, only way for next people to know the story is documentation. PnP PowerShell model is pretty classic approach and in general these remote APIs/extensions were used in 4000 tenants during February 2017. Not a unique case. Notice also that it's not "Bert's approach", he just published the documentation. There has been >100 contributors for open source PnP CSOM Core and PowerShell packages. – Vesa Juvonen Mar 9 '17 at 16:54

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.