SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.02k forks source link

SPFx Application Customizer not working on Classic experience #9960

Closed cardinalpipkin closed 1 month ago

cardinalpipkin commented 1 month ago

Target SharePoint environment

SharePoint Online

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

πŸ’₯ SharePoint Framework

Developer environment

Windows

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

Additional environment details

Describe the bug / error

The extension is an Application customizer which is designed to hide the Export to Excel button on any list in a site collection for both modern and classic views. It hides it on any list in Modern view but if I switch to classic the extension is no longer "triggering"? I have a repeated setInterval which runs the function every 5 seconds, so I know when the extension is working or not.

Steps to reproduce

  1. Create SPFx Application Customizer
  2. Make sure to set the serve.json with the site you want to debug against
  3. run gulp serve

Expected behavior

It should hide the Export to Excel button on the classic experience on a SharePoint Online list.

andrewconnell commented 1 month ago

That's by design... all SPFx extensions require the modern experience - they do not work in the classic experience.

Refer to the 2nd paragraph on the overview page:

SPFx Extensions enable you to extend the SharePoint user experience within modern pages and document libraries, while using the familiar SPFx tools and libraries for client-side development. Specifically, the SPFx includes four extension types: ...

I added the bold emphasis. If you want to do the same thing in a classic experience, you need to use the ScriptLink or delegate controls.

cardinalpipkin commented 1 month ago

Thanks Andrew, next time I will read the manual. Can you provide a link to some ScriptLink or delegate controls documentation or advice or do I have to make another ticket?

andrewconnell commented 1 month ago

Keep in mind this is all very old tech, dating back to SharePoint 2007. You're going to have limited success using it in newer versions of SharePoint (ie: SharePoint Online).