如果另一个组成员已登录,我需要向特定组成员显示下拉列表并隐藏相同的下拉列表。有没有办法使用Sharepoint Out-of-box功能执行此操作?
答案 0 :(得分:2)
SPSite site = new SPSite("http://mossportal/");
SPWeb web = site.OpenWeb();
SPList myList = web.Lists["My List"];
SPUser user = web.CurrentUser;
bool bPermission = myList.Permissions.DoesUserHavePermissions(SPRights.AddListItems);
System.Web.UI.WebControls.TextBox fldAdminComment = (System.Web.UI.WebControls.TextBox)this.FindControl("ctl00$m $g_80f418ab_bb35_4ece_9238_a13ec0c06fd8$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$ctl00$TextField");
System.Web.UI.WebControls.TextBox fldStatus = (System.Web.UI.WebControls.TextBox)this.FindControl("ctl00$m $g_80f418ab_bb35_4ece_9238_a13ec0c06fd8$ctl00$ctl04$ctl00$ctl00$ctl00$ctl04$ctl00$ctl00$TextField");
if (bPermission)
{
fldAdminComment.Enabled = true;
fldStatus.Enabled = true;
}
else
{
fldAdminComment.Enabled = false;
fldStatus.Enabled = false;
}
web.Dispose();
请更改您的字段文本框ID。
答案 1 :(得分:0)
您可以通过以下条件检查
bool check = SPlist.DoesUserHavePermissions(SPContext.Current.Web.CurrentUser,SPBasePermissions.ViewListItems);
提供帮助。