SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to set all document properties programmatically inside the event handler. I do not manage to skip an edit form after the document is uploaded. Any help is welcome.

share|improve this question

There is a matter of at which point in the event handling the document properties should or can be updated. This post explains the various Events and their variations ('-ing', '-ed', etc) - not all properties are available during the synch/asynch event handling - Managing ItemUpdating and ItemUpdated Events..

An alternative, is to use PowerShell for document upload. Paul Childs has a PowerShell example that can provide a solution - Bulk upload files with metadata into SharePoint using PowerShell: UPDATE

share|improve this answer

JavaScript solution for SharePoint 2013

In SP.UI.Dialog, there is a function to close a dialog : commonModalDialogClose

Takes two parameters, commonModalDialogClose(dialogResult, returnValue)

dialogResult is an enum (here is an extract from SP.UI.Dialog.js :

SP.UI.DialogResult.prototype = {
    invalid: -1,
    cancel: 0,
    OK: 1

Solution : When using the upload.aspx page, you will be redirected to the EditForm.aspx including a QueryString parameter, Mode, that will be tagged as Upload. Using that information, the dialog can be closed. The QueryString parameter is retrieved using the GetUrlKeyValue SharePoint native function.

GetUrlKeyValue(keyName, bNoDecode, url, bCaseInsensitive)

add the following into the library EditForm.aspx using JSLink

(function (){
    var mode = GetUrlKeyValue("Mode", false, window.location.href, true);

    if (mode == "Upload")
        //commonModalDialogClose(dialogresult, resultValue)
        //dialog result : -1 = invalid; 0 = cancel; 1 = ok
        //resultValue : text
        commonModalDialogClose(0, null);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.