Click here to Skip to main content
15,939,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can any one there tell me that how can we add event listener for a document library list in sharepoint 2013 like shared Documents in sharepoint 2013. Actually I want that when logged in user click on shared document or document library list in sharepoint 2013 then and event should fire that decide that partical user has privilige to see the uploaded documents and i wanna do all this programmatically in visual studio 2012. and no one can see the document libraries list documents except system login user or admin.

Please, give me a helpful solution as soon as possible.


AnandSharmaUK 11-Apr-13 7:36am    
So you want only your admin to view the library? If that is the case, break the inheritance within the library and explicitly assign permission to the admin. This will solve your problem.
usmanali.ali843 16-Apr-13 4:13am    
thanks for you reply. sorry the scenerio little changed i want that i have all schools / colleges and universities document uploaded by their students on my sharepoint site now the thing i required is that is it possible that when a student login to my site and when click on the document library of sharepoint then just the document uploaded by him relevant to his school/colleage/university just visible to him currently all documents of all schools colleges and universites showing to all students.

1 solution

Solution 1:

Create an event receiver on ItemAdded, so whenever a student uploads a document, the event receiver fires and breaks the inheritance and assigns explicit permission to the student. That ways you can assign permission to items to whosoever you want to. For code to implement this you can follow

Solution 2:

1.Create a view within the document library with a filter Show items where created by is [Me]
2.Set default view to this view within the document library and remove all other views
3.Control permissions in such a way that the students cannot change views so they will only see the documents that they have uploaded

Hope this helps. Let me know if that resolves your problem or we can think of some other solution.
Share this answer
usmanali.ali843 16-Apr-13 5:26am    
but the problem is about maintenance of that project my friend if a student moved fron one school/college/university to another one then how would we update all permissions to see document uploaded by that student to watch his/her all documents uploaded for all particular school/colleg/univer. and if we have 100s of schools , colleges/ unive then don't you think that will be so tough task for maintenance and also would load all site of sharepoint.
AnandSharmaUK 17-Apr-13 6:57am    
If that's the case, please explain your scenario properly so as someone can provide you an apt solution. Does each school/college have their own site collection? Explain your situation in a bit more details.
usmanali.ali843 18-Apr-13 8:25am    
thanks for reply okay the scenario is:
In our old version, we have document list collections of each schools, colleges and universities
and whenever a student login to our site then he was able to see his uploaded documents in each schools/college/university list collections and there he has to search his uploaded documents in every institute where he belonged and there documents submitted by other users related to that institute also showing him/her and that was implemented by active directory but now we are going to move on forms based authentications so each user can login to our site and when he login we would show all documents uploaded by him/her in a single document list collection containing all institutes document(School,college,univ) where he just can see documents uploaded no content operations should be able for him/her like edit, upload, delete or other else just can view datagrid of document list while site admin can view all users documents and perform all sort of operations as well. Thanks in advanced
AnandSharmaUK 18-Apr-13 10:01am    
You can write a custom webpart in such case and fetch documents from all the college/school websites which the user has uploaded and display the list to the user in a grid. Here is the sample code:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900