I am new in developing sharePoint.

I try to use SPHierarchyDataSourceControl of sharepoint to display a SPTreeView of all sites, doclibs and folders in my site.

I set the property "Web" to "SPContext.Current.Site.RootWeb" and the "RootWebId" to "SPContext.Current.Site.RootWeb.ID"

My problem is that users can see in the tree - DocLibs and sites that they don't have permissions to see. What can I do to show in the tree only doclibs that the user has minimum readonly permission ?

thanks !!!


If you run your code under elevated privileges, user can see everything but then you need security trim(depends on your security rules) parent site. If you just show tree, I might be OK but if user clicks tree node and if user runs some processes based on this click, you need to security trim to your tree and you should be careful that because easily you can create security hole.

If you use it using master page code in SP Designer than please try Security Trimming on the SPTreeView.

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.