/// <summary> /// NOTE: call for TFS 2010 only. /// Checks if a group exists, in the team project. Creates the group, based on createIfNew flag. /// </summary> /// <param name="projectUri">The team project Uri</param> /// <param name="searchableGroupName">The name of the group in [TeamProject]\GroupName format</param> /// <param name="groupName">The name of the group</param> /// <param name="createIfNew">Flag to create the group, if new</param> /// <returns>True, if successful</returns> private bool CheckIfGroupExists_TFS10(string projectUri, string searchableGroupName, string groupName, bool createIfNew) { try { Identity groupIdentity = groupSecuritySvc.ReadIdentity(SearchFactor.AccountName, searchableGroupName, QueryMembership.Direct); if (groupIdentity == null && createIfNew) { string result = groupSecuritySvc.CreateApplicationGroup(projectUri, groupName, groupName); FileHelper.Log("Security Group created..." + groupName); } else { FileHelper.Log("Security Group identity found..." + groupName); } } catch (Exception ex) { FileHelper.Log(ex.Message); FileHelper.Log(ex.StackTrace); return(false); } return(true); }