protected override void ExecuteCmdlet() { var groupId = Team.GetGroupId(HttpClient, AccessToken); if (groupId != null) { var channel = Channel.GetChannel(HttpClient, AccessToken, groupId); if (channel != null) { WriteObject(TeamsUtility.GetMessages(HttpClient, AccessToken, groupId, channel.Id, IncludeDeleted), true); } else { throw new PSArgumentException("Channel not found"); } } else { throw new PSArgumentException("Team not found"); } }