Forum Discussion
How to disable Drag and Drop feature in sharepoint online document library
Hi All,
Based on project requirement, we are using custom forms while uploading documents in SharePoint Online site using SPFx. However the drag and drop feature directly uploads the document, without loading the custom form. We are looking for 2 solutions if possible:
1. How can we disable the drag drop feature in sharepoint online. Is it possible with spfx or any other workaround?
2. If a document is drag dropped, our custom form should load immediately after uploading the document, so that the purpose of creating the custom form will be served. Can this be achieved in any way..?
Any lead will be helpful.
- Paul de JongIron Contributor
About 2. This is not trivial. Using SPFx you can inject JavaScript logic into the page and then try to detect changes and show the custom form when documents are being uploaded. Another approach is to use Power Automate.
Making this solution 100% reliable is going to be a challenge. Does your form also show when users click the Upload button or upload 10's of documents or a folder structure? or when they use OneDrive for Business client or apps on mobile devices? Do you also need to cater for documents being added to the library via Cop (or Move) from other libraries? - SvenSieverdingBronze ContributorYou could create an app page running an spfx webpart as a single page application.
In that webpart create the file view yourself using i.e. a "Fluent UI DetailsList". If the user selects an item, display your edit form. Now create your own file upload dialog using a FilePicker Control (https://pnp.github.io/sp-dev-fx-controls-react/controls/FilePicker/)
Then redirect your users to use that app page instead to the list.
If you don't want to use much functionality from the default list view control (like Sharing, Copy&Past etc) and if you already have a custom SPFX form then this might not be that much additional work.
Best Regards,
Sven