protected override void ExecuteCmdlet() { var groupId = Identity.GetGroupId(HttpClient, AccessToken); if (groupId != null) { if (Force || ShouldContinue("Removing the team will remove all messages in all channels in the team.", Properties.Resources.Confirm)) { var response = TeamsUtility.DeleteTeamAsync(AccessToken, HttpClient, groupId).GetAwaiter().GetResult(); if (!response.IsSuccessStatusCode) { if (GraphHelper.TryGetGraphException(response, out GraphException ex)) { if (ex.Error != null) { throw new PSInvalidOperationException(ex.Error.Message); } } else { WriteError(new ErrorRecord(new Exception($"Team remove failed"), "REMOVEFAILED", ErrorCategory.InvalidResult, this)); } } } } else { throw new PSArgumentException("Team not found"); } }