开发者

Sharepoint Web services: How to get permissions for a Document Library for the current user programmatically

开发者 https://www.devze.com 2023-02-21 15:07 出处:网络
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 permis

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... :(

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);
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号