When uploading a document to a document library, if you drag and drop it doesn't ask for any meta data and gets checked out to the logged in user. Any suggestion to make users enter metadata through drag and drop?


Apply metadata to documents when drag and drop a file. There is a bit of hardcoding, but here is what I did and it seems to be working. I am still testing this. If you have a way to get the current listname at runtime that would be brilliant! I have this in a CEWP on the library allitems.aspx page itself. I will move this to masterpage after more testing. You can also change the caml to get the list items.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script><script unselectable="on">
 window.onload = function(){ 
 setTimeout(  function(){ 
 if(typeof UploadProgressFunc != "undefined"){ 
 }, 4000); 

    function MyNewFunction() { 

        var caml = "<View><Query><Where>"
            + "<Eq><FieldRef Name='FSObjType' /><Value Type='int'>0</Value></Eq>"
            + "</Where>" 
            + "<OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy>" 
            + "</Query>"
            + "<ViewFields><FieldRef Name='ID' /></ViewFields>"
            + "<RowLimit>1</RowLimit>"
            + "</View>";

    var ctx = SP.ClientContext.get_current()
    var web = ctx.get_web();
    var list = web.get_lists().getByTitle("test1")
    var query = new SP.CamlQuery();
    var items = list.getItems(query);
    ctx.executeQueryAsync(function() {
        var enumerator = items.getEnumerator();
        var item = enumerator.get_current();
        var id = item.get_id();
    }, function() { 
        //failure handling comes here


       function _MyGotoEditForm(id) { 
       var options = SP.UI.$create_DialogOptions(); 
       options.title = "Add File Metadata"; 
       options.url = "http://**SITENAME**/**LIBRARYNAME**/Forms/EditForm.aspx?ID="+id; 
       options.autoSize = true; SP.UI.ModalDialog.showModalDialog(options); } 

File Drag and Drop Prompt Metadata Properties Dialog

Also check this one: http://bhanuprakashbysani.blogspot.com/2014/12/enforce-drag-and-drop-documents-to.html

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.