Esempio n. 1
0
        protected override void ExecuteCmdlet()
        {
            var groupId = Team.GetGroupId(HttpClient, AccessToken);

            if (groupId != null)
            {
                try
                {
                    if (Force || ShouldContinue($"Remove user with UPN {User}?", Properties.Resources.Confirm))
                    {
                        TeamsUtility.DeleteUser(HttpClient, AccessToken, groupId, User, Role);
                    }
                }
                catch (GraphException ex)
                {
                    if (ex.Error != null)
                    {
                        throw new PSInvalidOperationException(ex.Error.Message);
                    }
                    else
                    {
                        throw ex;
                    }
                }
            }
            else
            {
                throw new PSArgumentException("Group not found");
            }
        }