sharepoint 查找 Loginuser在item 中的权限
using (SPSite site = new SPSite(approver.ParentTask.WFContext.Web.Site.ID))
{
using (SPWeb currentWeb = site.OpenWeb(approver.ParentTask.WFContext.Web.ID))
{
SPList currentlist = currentWeb.Lists[this.ListID];
SPListItem superItem = currentlist.Items.GetItemById(this.ItemID);
SPRoleAssignmentCollection raCollection = superItem.RoleAssignments;
SPRoleDefinitionBindingCollection roleDefinitionCollect = new SPRoleDefinitionBindingCollection();
for (int i = 0; i < raCollection.Count;i++ )
{
if (raCollection[i].Member.LoginName == userID)// 判断用户是否与指定用户一样。
{
roleDefinitionCollect = raCollection[i].RoleDefinitionBindings;
break;
}
}
if (roleDefinitionCollect != null && roleDefinitionCollect.Count > 0)
{
foreach (SPRoleDefinition useritemrole in roleDefinitionCollect)
{
//循环输出权限 如 读取 查看,设计,参与者
}
}
}
}