Friday, 3 July 2015

How to find out SPUser belongs to Specific Group

How can I find out programmatically if current user belongs to some group on sharepoint website?

We can use below code:

SPWeb site = SPContext.Current.Web;
SPGroup managerGroup = site.Groups["Your_Group_Name"];

bool isManager = site.IsCurrentUserMemberOfGroup(managerGroup.ID);

Hope this helps!!!!

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...