How to prevent document is saved/uploaded in document library? RRS feed

  • Question

  • Hello,

    I got an issue, document is saved/uploaded even mandatory document properties are not inserted.
    How to prevent document is saved and uploaded?

    Any solution?

    Thank you.

    Monday, May 15, 2017 4:09 AM

All replies

  • "out of the box there is no way you can disable the upload before the document properties form is loaded. Programmatically, it can be possible but it wont be a good approach to address any business requirement by changing the behaviour of the document upload form which is there by "application design" of the SharePoint platform.  if possible you can use a simple webpart to upload the document in a document library and expose the page to the users where this document is uploaded. They can choose to rename and do other modifications before the "actual" upload is initiated."

    SharePoint School | Blog-

    • Proposed as answer by NHT81 Tuesday, May 16, 2017 6:19 AM
    Monday, May 15, 2017 10:49 AM
  • Hi Ameenah,

    This is indeed the OOTB behaviour. Possible alternatives to consider are:

    - educate user community to set the required fields
    (note when they upload through windows explorer or Office the users will need to open the browser in a separate step and enter the required field. My experience is that users will simply not enter the required field in a significant number of cases.)
    - Create report to find items that have empty required fields (e.g. run daily)
    - use 3rd party tools to upload items (that enforce entering required fields). This will only cater for the cases where upload happens through a browser
    - create a workflow that sends an email to the user if he/she has uploaded a document without required fields (i.e. push).

    I am afraid there is no simple and elegant solution to your problem.


    Monday, May 15, 2017 12:05 PM
  • Thank You for your alternative solution.
    Monday, May 22, 2017 9:35 AM
  • Hi Ameenah,

    If you think the reply is helpful, you can mark it as an answer.

    Best regards,

    Linda Zhang

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Tuesday, June 6, 2017 1:55 AM
  • Hi,

    You can try the "ItemAdding" event logic to check whether the user added the mandatory fields.

    Sample code snippet,

    public override void ItemAdding(SPItemEventProperties properties)
    properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl
    properties.RedirectUrl ="custom error message file Url"l;

    Please remember to click Mark as Answer on the answer if it helps you

    Tuesday, June 6, 2017 4:39 AM