Wednesday 22 April 2015

In SharePoint document library we will be storing the documents.But I had a requirement that i have a document library with country field, but as i have to find out the logged in user country by querying the user profile properties of the current logged-in user and i have to show only that country documents to that user.

To achieve this functionality i took help of JavaScript/J Query and Content Editor web part. I have written script and i placed that script inside the library.

Steps to achieve this:

1.Create a document library with the columns(in my case i have created User Name User Country).
2. Upload documents for different countries.
3.Copy paste the below script into a text file and upload into your site (I have stored it in the site assets library).
4.Edit the document library you created in first step
5.Add the content editor web part and in the content link copy paste the URL of the uploaded file(copy the path of the text file which you uploaded into site assets library).
6. And you are done test it with different country users

Find the script

0 comments:

Post a Comment