CAML查询显示ListItems基于当前用户权限 [英] CAML Query to Display ListItems Based on current user permissions

查看:102
本文介绍了CAML查询显示ListItems基于当前用户权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在代码中如何使用CAML查询时遇到一些问题。



我的方案是当用户登录站点时检查该特定用户在站点上的权限,然后以表格形式显示由他创建的所有列表项或由他创建的任务,每个月都有一系列任务。



我无法理解如何为登录用户集成或同时使用权限检查和显示列表项,以便其他用户数据不可见他是。



任何人都可以指导我这个或指导我一个结构良好的代码,我可以参考。



我是新手,并且很难理解它是如何工作的。



提前感谢

Hi,

I am facing a little problem in how to use CAML query in my code.

My scenario is as a user logs in the site check that particular user for his permissions on site and then display all the list items created by him or tasks created by him in a tabular form with a count of tasks for every month.

I am not able to understand how to integrate or use both the permission check and display list items together for the logged in user so that other users data is not visible to him.

Can any one guide me in this or direct me to a well structured code wherein i can get a reference.

I am novice in this and having a tough time in understanding how it all works.

Thanking in advance

推荐答案

您无需担心要查询的列表上的用户权限,因为SharePoint将返回结果b关于列表上的用户权限。



仅返回当前登录用户创建的项目,您可以使用以下CAML查询



You have no need to worry about the permission of the user on the list to be queried because SharePoint will return the results based on the user permission on the list.

For returning only the items created by the current logged in user you can use the following CAML query

"<Where>
 <Eq>
  <FieldRef Name="Author" LookupId="TRUE" />
  <Value Type="Integer">" + SPContext.Current.Web.CurrentUser.ID + @"</Value>
 </Eq>
</Where>"


这篇关于CAML查询显示ListItems基于当前用户权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆