zoukankan      html  css  js  c++  java
  • C# sharepoint client object model 获取Web和List的权限

    Web webSource = contextSource.Web;
    contextSource.Load(webSource);
    contextSource.ExecuteQuery();

    List listSource = ClientOperateInfo.GetListMessage(contextSource, "", ListTitle);
    contextSource.Load(listSource);
    contextSource.ExecuteQuery();

    IEnumerable webroles = contextSource.LoadQuery(webSource.RoleAssignments.Include(roleAsg => roleAsg.Member, roleAsg => roleAsg.RoleDefinitionBindings.Include(roleDef => roleDef.Name, roleDef => roleDef.Hidden)));
    contextSource.ExecuteQuery();

    IEnumerable listroles = contextSource.LoadQuery(listSource.RoleAssignments.Include(roleAsg => roleAsg.Member, roleAsg => roleAsg.RoleDefinitionBindings.Include(roleDef => roleDef.Name, roleDef => roleDef.Hidden)));
    contextSource.ExecuteQuery();

    Dictionary<string, string> permisionLists = new Dictionary<string, string>();
    foreach (RoleAssignment ra in listroles)
    {
    RoleDefinitionBindingCollection rdc = ra.RoleDefinitionBindings;
    string permission = string.Empty;
    foreach (RoleDefinition rdbc in rdc)
    {
    permission += rdbc.Name.ToString() + ", "; //权限级别
    }
    permisionLists.Add(ra.Member.Title, permission);
    }

    //循环输出权限
    foreach (var listPermission in permisionLists)
    {
    Console.WriteLine(listPermission.Key + "..." + listPermission.Value);
    }

  • 相关阅读:
    3-为什么很多 对 1e9+7(100000007)取模
    6-关于#include<bits/stdc++.h>
    7-n!的位数(斯特灵公式)
    5-math中函数汇总
    6-找数的倍数
    6-Collision-hdu5114(小球碰撞)
    5-青蛙的约会(ex_gcd)
    4-圆数Round Numbers(数位dp)
    4-memset函数总结
    一种Furture模式处理请求中循环独立的任务的方法
  • 原文地址:https://www.cnblogs.com/selenazhou/p/12988761.html
Copyright © 2011-2022 走看看