Return to Snippet

Revision: 34741
at October 27, 2010 23:40 by scholli


Initial Code
public static class SecurityHelper
    {
        public static bool IsUserMemberOfGroup(SPUser user, string groupName)
        {
            bool result = false;

            if (!String.IsNullOrEmpty(groupName) && user != null)
            {
                foreach (SPGroup group in user.Groups)
                {
                    if (group.Name == groupName)
                    {
                        // found it
                        result = true;
                        break;
                    }
                }
            }

            return result;
        }
    }

Initial URL

                                

Initial Description

                                

Initial Title
Check if user is member of a SharePoint group

Initial Tags
security, sharepoint

Initial Language
C#