Subscribe:

Labels

Sunday, December 11, 2011

check the condition the group in exist or not


these 2 metod are using for check the condition the group in exist or not

private bool isGroupAlreadyExist(SPWeb web, string groupName)
        {
            bool isExist = false;

            try
            {
                SPGroup group = web.SiteGroups[groupName];
                isExist = true;
            }
            catch (SPException)
            {
                isExist = false;
            }
            catch (Exception)
            {
                isExist = false;
            }
            return isExist;
        }


if (!isGroupAlreadyExist(web, groupName))
                {
                   
                }


No comments:

Post a Comment