1

I would lke to add a Script Editor to the SharePoint Document Library's Upload.aspx page to do something similar to https://www.c-sharpcorner.com/article/pre-save-action-on-document-libraries-in-sharepoint-2013-and/ but on Upload. Any idea how this can be achieved?

How can I click the gear to add script to such a page: enter image description here

0

[Must be working]
You can:
1. Add javascript to Master page through SharePoint Designer. This js will check page URL and if it is on Upload page then it will call your custom PreSaveAction logic.
2. Create custom Upload page. Like here. You need to create custom Application page in Visual Studio, deploy it through feature, feature must update SPWeb.CustomUploadPage property.
3. Note: If your PreSave logic doesn't contain any validation logic, just additional actions like if document uploaded then new list item must be created in another list or similar things.
Add event-based (event receiver, workflow) or periodically running code (Console App, Windows Service, Timerjob, PowerShell script) that will perform your actions.

[Not working - See comments]
Open Upload.aspx page, browser right corner Gear icon, Edit Page, add your script editor web part, click Stop Editing button. It will work correctly.
In guide on c-sharpcorner they use ribbon "Default Edit Form" button because they don't want to think what form is default. Forms count can be multiple. Upload page in one instance.

  • How can I click on the gear in such a situation (see edit above pls) – Saz Mifsud Dec 10 '18 at 8:42
  • Note: I just checked this. It is wrong way. Sorry. You cannot customize directly /layouts/Upload.aspx page. I will write now other ways how you can do it. But for your information I will write about how to open such pages. To do it if your upload page in modal dialog opened perform this steps: [If you know real URL of Upload.aspx page then you can just open it in new tab. If you don't know then perform 1-5 steps below] 1. Open Developer Tools console. In Google Chrome just press F12 button. 2. In console choose Network tab. – user80188 Dec 10 '18 at 15:19
  • 3. With opened console and its Network tab make actions to see modal dialog with Upload.aspx page. Ex. try to upload any document. 4. In Network tab you will see record about Upload.aspx page. Right click on it and Open in new tab. 5. On newly opened tab remove from URL part "&IsDlg=1" and click Enter button. So we will open page in isolated browser tab without modal dialog mode and now we have access to Gear icon. – user80188 Dec 10 '18 at 15:20
  • I think you have another options to customize your Upload.aspx page. I see this 2 ways: 1. Add javascript to Master page through SharePoint Designer. This js will check page URL and if it is on Upload page then it will call your custom PreSaveAction logic. 2.Create your own custom application page and set it as custom Upload page. Main logic here - create Application page in Visual Studio, deploy it through feature, feature must update spweb.CustomUploadPage property. You can use this guide: yetanothersharepointblog.wordpress.com/2012/09/30/… – user80188 Dec 10 '18 at 15:25
  • And another one ways. If your PreSave logic doesn't contain any validation logic, just additional actions like if document uploaded then new list item must be created in another list or similar things. Here you can use: 1. List event receiver that will perform additional actions on list item creation (document uploading). 2. Workflow that also works such as event receiver. 3. Periodically running code (Console App, PowerShell sctipt, Windows Service) that will go to your document library and perform needed actions. – user80188 Dec 10 '18 at 15:32

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.