0

I have two document libraries: bucket and Documents. The user uploads the file to the bucket and when all the field are filled, an event receiver checks if the filename already exists (and renames it) and copies the file to Documents.

At the bucket list, I want to inform the user that the filename already exists. I can't find (in Web Api results) a field with the filename.

Are there any other solutions?Even startswith will be fine.Thank you.

0

Use FileLeafRef field to query document names. See this example: http://platinumdogs.me/2009/07/21/querying-document-libraries-or-pulling-teeth-with-caml/

0

Option 1: You can directly add javascript to the item updating event using ClientScript.RegisterStartupScript to notify the file change.

https://stackoverflow.com/questions/11999312/popup-alert-message-using-event-receiver-in-sharepoint-2010

https://social.msdn.microsoft.com/Forums/sharepoint/en-US/73c6a74d-763e-428c-9f49-66920f2dd0b6/how-to-show-popup-window-in-ing-event-receiver

Option 2: Disable File overwrite option 1. Please take a look at this Stack question. It points to a tutorial blog on how to do this.

In SPD open default.master, then add the script:

$(document).ready(function()
    {
    var form = $('form');
    if ( form.attr('action').indexOf('YOUR 36 character List ID - Without Braces') > -1 )
        {
        var checkbox = $('#ctl00_PlaceHolderMain_UploadDocumentSection_ctl03_OverwriteSingle');
        checkbox.removeAttr('checked');
        checkbox.parent().hide();
        var multiple = $('#ctl00_PlaceHolderMain_UploadDocumentSection_ctl03_UploadMultipleLink');
        multiple.hide();
        }
    }
);

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.