Tuesday, January 3, 2017

How to skip an edit form after uploading a single document in SP 2013

How to skip an edit form after uploading a single document in SP 2013

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 uloaded.

Solution :

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.aspxincluding 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 GetUrlKeyValueSharePoint 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);
    }
})();
Hope this help,

Optimising bulk inserts with Entity Framework 6

Optimising bulk inserts with Entity Framework 6 In Entity Framework 6+ the database context implements the  unit of work  pattern so th...