0

How can we implement a functionality on a SP Document library in which user with login name 000.xyz will be shown only documents which contains 000 in its name ??

  • try add filter in library view or create a new view fir library... – cjs Jun 15 '17 at 16:19
  • 000.xyz is the current user or a "hard coded" user? – Juan Pablo Pussacq Laborde Jun 15 '17 at 17:13
  • @jpussacq - We need to make it dynamic . If any document with the same name as that of current logged in user , that document must be shown to the user . Remaining all documents will be hidden for user . – Rohit Kharade Jun 16 '17 at 3:53
  • @cjs- We need to make it dynamic . – Rohit Kharade Jun 16 '17 at 3:54
2

I think there is no simple solution. Filters that use the [ME] wildcard only work with columns of the person type.

Possible solution:

  1. Create a column of type "person" to filter. Suppose it has the name FILTER_DOC.
  2. That column must have the value of the user's login. This value must be calculated dynamically based on the name of the document.
  3. You can calculate it in two ways. With a workflow or with an event handler.
  4. With either of the two options in point 3, you must keep in mind that there may be a name change.
  5. Then create a view with the filter:

    FILTRO_DOC = [Me]
    

I hope you understand the idea. Requires setting up a workflow in SharePoint Designer or developing an event handler in C # in Visual Studio.

I think an event handler is a best and most flexible option. I do not recommend using a workflow for this. It is not natural.

  • @RohitKharade We have noticed that you have a lot of questions with a good answer, but you don’t care to Upvote and Mark the correct answer as accepted!!! Please if this answer helped/solved your issue, upvote and mark it as the accepted to be useful for future visitors.! Don't forget to do that for all previous questions in case it solved your issue !! Thanks for your contributions! – Mohamed El-Qassas MVP Jun 17 '17 at 17:13
  • Is there any way in which we can do this by client object model or using JSOM ? – Rohit Kharade Jun 23 '17 at 4:30
  • Not sure, you need to implement a custom page... So you will lost standard view... – Juan Pablo Pussacq Laborde Jun 23 '17 at 11:58

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.