Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i want an event handler for document library (itemadding and itemChekingIn) that does not allow to add a file to that document library that already been in there.does anyone can give me hint for this??

share|improve this question
add comment

3 Answers

I had a somewhat similar requirement when I needed to prevent uploading of duplicate files to document library. You may find this link useful to get started: http://sharepointnadeem.blogspot.in/2011/12/prevent-duplicate-files-to-be-uploaded.html

share|improve this answer
add comment

Yes it is possible here are some links, this should help you to get started into the right direction:

Shows you the events for document library event handler http://msdn.microsoft.com/en-us/library/dd587315(v=office.11).aspx

this talks about the types of events handlers and recivers http://sharepointlogics.com/2008/12/event-handlers-and-event-receivers-in.html

this person is making an event handler for document library http://johanolivier.blogspot.co.uk/2009/12/sharepoint-simple-event-handler.html

In depth on Event Handler Feature http://www.codeproject.com/Articles/17989/Extending-SharePoint-Server-2007-by-using-Features

with all these you should become a pro ;) . The documentation from msdn alone is gold dust!

EDIT** as ketan has said you can just check if item exists to not add it in ;) but i guess if you want to learn and/or do other functions than the above is more than enough to get you going!

hope this helps :)

share|improve this answer
add comment

@amin ba...yes we can do this based on which parameter/metedata field you want to check for duplicate item?

you can use CAML query to find if the item with that metadata field and based on no. of results returns you can identify if item already exist or not.

share|improve this answer
    
also...check the library settings which says "Overwrite if Item exist"...i think setting this to false..would not accept duplicate items –  Ketan03 Aug 14 '12 at 8:44
add comment

Your Answer

 
discard

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.