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

How can we filter a list (while loading) by comparing it with a filter value that exists on the server side in Sharepoint 2010. i.e for example

http://server/site/lists/AllItems.aspx?employeeId=123456

I know that we can implement this with QueryStringFilter webpart, but it is not secure as anyone can change the employeeId value in the URL.

We can get the employeeId on the server side from logged in user, but we don't know how to filter the view only for his Id. Is there a way to intercept the List load to set this filter ?

share|improve this question
add comment

2 Answers 2

You can make use of the new SharePoint 2010 rest services (listdata.svc) to filter your list data inside your code.

More here: http://msdn.microsoft.com/en-us/library/ff798339.aspx

share|improve this answer
    
Where should we put the code to filter the list. Should we write some kind of usercontrol/aspx page & refer it in the master page ? Could you point me to an example. Thanks vivek –  user1967 Dec 14 '10 at 16:37
    
Well depending upon your requirements, you can write a user control and register it using a delegate control. Or you can write a web part. –  Vivek Dec 15 '10 at 5:48
add comment

If the employeeid is stored in a user profile property, you could use a "Current User Filter"

http://office.microsoft.com/en-ca/sharepoint-server-help/work-with-filter-web-parts-HA010033786.aspx

It works in a similar way to the QueryStringFilter, being you add it to the page that the list in on.

Then you configure the web part properties, setting the "Value to provide" to be employeeid

Then connect the filter to the list view, providing the value to the employeeid on the list.

http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=99

share|improve this answer
    
Exactly why we dont want to use this as we want to keep the list secure & only load items belonging to an employee by his ID. In the above example we can get the posts by changing the ID=100, ID=98, ID=97 sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=100 sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=97 –  user1967 Jan 8 '11 at 18:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.