How to disable drag and drop in sharepoint online

Sridhar Shankar 20 Reputation points
2024-07-26T15:11:59.3833333+00:00

We have a business case to disable drag and drop functionality in sharepoint online. Please help

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,824 questions
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 36,171 Reputation points Microsoft Vendor
    2024-07-29T02:11:40.73+00:00

    Hi @Sridhar Shankar,

    You could use following script to stop drag and drop in sharepoint online

    ExecuteOrDelayUntilScriptLoaded(function() {
        g_uploadType = DragDropMode.NOTSUPPORTED;
        SPDragDropManager.DragDropMode = DragDropMode.NOTSUPPORTED;
    }, "DragDrop.js");
    

    If you are using sharepoint modern page, you could create web parts with the SharePoint Framework SPFx or download samples from github at https://www.sharepointpals.com/post/step-by-step-procedure-to-add-a-js-file-to-all-pages-in-a-spfx-modern-pages-using-sharepoint-framework-extension/ where there are instructions for downloading and installing them.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.