Sharepoint Web 服务:如何以编程方式获取当前用户对文档库的权限 [英] Sharepoint Web services: How to get permissions for a Document Library for the current user programmatically

查看:50
本文介绍了Sharepoint Web 服务:如何以编程方式获取当前用户对文档库的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我希望显示当前用户对其具有写入权限的所有文档库.我怎么能得到这个信息...... GetLists 没有返回任何关于权限的信息......而GetPermissionCollection"只在用户具有完全控制权限时才返回权限......所以它没有用......:(

I have an application where i wish to display all document libraries for which the current user has Write permissions. How can i get this information... GetLists doesnt return me anything about permissions... Whereas, "GetPermissionCollection" only returns me the permissions when the user has Full control as permissions....so it is of no use... :(

我们没有像GetRolesAndPermissionsForCurrentUser"这样的东西来获取列表的权限.我正在使用它来获取当前用户的站点级别权限......但这不适用于列表:(

Dont we have anything like "GetRolesAndPermissionsForCurrentUser" to get permissions for lists. I am using this to get the site level permissions for the current user... But this does not work for lists :(

有人请帮忙..... :(

Someone please do help..... :(

推荐答案

可以查看当前用户在列表中的权限:

You can check for the permissions the current user has on the list:

List<SPList> lists = new List<SPList>();
foreach (SPList spList in properties.Web.Lists)
{
  if (spList.DoesUserHavePermissions(SPBasePermissions.EditListItems))
  {
    lists.Add(spList);
  }
}

这篇关于Sharepoint Web 服务:如何以编程方式获取当前用户对文档库的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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